GUI libraries are usually very large and therefore it is as time consuming to learn a new language as it is to learn a new GUI library. The F# interactive can be very helpful in exploring the Winforms GUI toolkit through its auto-completion feature.
> open System;; > open System.Windows.Forms;; > let form = new Form();; val form : Form = System.Windows.Forms.Form, Text: > form.Visible <- true;;
Now, try to explore the content of this forms object through auto-completion invoked by typing the TAB-key after entering the object name following a dot. On each TAB key-press a possible auto-completion should appear. You may move backwards by pressing Shift-TAB.
> form.
Move forward until you reach the element ‘Text’ and enter ‘<- “Hello”‘ to assign a text to the window.
> form.Text <- "Hello";; val it : unit = () >
You may also enter partially completed text and ask the interactive to check for possible completions.
> form.Clo // first completion after TAB > form.Closing // second completion after TAB > form.Close // third completion after TAB > form.Closed
I always keep an interactive F# session open while coding to explore the API directly.
Hi,
thank you for putting these turorials together. I am also in the process of learning F# and I appreciate your easy to follow examples.
Stefano
Thanks for the feedback, 2sharp4u!