SIMPOL Documentation

Getting the Basic Form Running

In this section we will now add all the minimum bits remaining in order to get our program to run and show the form. It won't do anything yet, but at least we will be able to see the form come up in the dialog window, and we will also be able to close the window and have the program exit correctly.

In order to do this, we need to at least add the functions, even if they don't yet do anything. That code is shown below.

Example 5.2. The remaining Empty Functions of the colorlab Program
function adjustformcolorvals(wxform f, integer rgbval, \
                             string ignorescrollbar="")
end function

function hexval_olf(wxformedittext me)
end function

function decval_olf(wxformedittext me)
end function

function redval_olf(wxformedittext me)
end function

function greenval_olf(wxformedittext me)
end function

function blueval_olf(wxformedittext me)
end function

function redscroll_os(wxformscrollbar me, string scrolltype)
end function

function greenscroll_os(wxformscrollbar me, string scrolltype)
end function

function bluescroll_os(wxformscrollbar me, string scrolltype)
end function

function okbtn_oc(wxformbutton me)
  wxdialog d

  d =@ me.form.container
  d.setvisible(.false)
end function

function errormsg(string s)
  wxmessagedialog(message=s, captiontext="SIMPOL Color Lab \
                  Error", style="ok", icon="error")
end function        
      

The remaining functions shown above don't yet do anything, except for the okbtn_oc, which merely sets the dialog visibility to .false, which results in the code exiting the processmodal() method and the program then exits.

[Note]Note

Another useful naming convention can be seen in the names of the functions. The beginning portion of the name indicates the control with which it is associated, followed by an underscore, and then a set of letters describing the event. Below is a table of potentially useful names for the portion following the underscore.

Table 5.2. Event Handling Function Naming Conventions
SuffixExplanation
oconchange
oconclick
occoncellchange
ocsoncellselect
ocwconcolwidthchange
odcondoubleclick
ogfongotfocus
olfonlostfocus
omonmouse
omonmove
orhconrowheightchange
osonscroll
osonselect
osonsize
osconselectionchange
osconstatechange
ovconvisibilitychange

At this point, it should be possible to build and run the program. It doesn't do anything yet, other than display the form, but it is a nice place to be, since now all that is left is manipulating the form in response to user-generated events (or in other words, filling in those empty functions).