GUI Object

'A very simple to program GUI class
'Start by adding controls, then open the form.  Each control has an index.
'the form can be modal or non-modal.
'non-modal panel should have an event loop which runs while a zero or positive conrol index is 'returnd.  A negative index means ok or cancel was pressed by the user.
'A modal panel won't return until the user pressed ok or cancel, so an event loop isn't needed.


Function
AddControl(ControlType As String, Caption As String, Value As Long, Min As Long, max As Long, Flags As Long) As Long

Sub
OpenPanel(Optional ByVal Modal As Boolean = False)

Sub
SetCaption(Caption As String)

Sub
SetSettings(Index As Long, Set_Value As Long, Set_String As String)

Sub
GetSettings(Index As Long, ByRef Returned_Value As Long, ByRef Returned_String As String)

Function
WaitOnEvent(ByRef Returned_Value As Long, ByRef Returned_String As String) As Long

Sub
ClosePanel()

Sub
SetList(Index As Long, element As Long, Set_List As String)

Sub
SetSpacing(Set_Spacing As Long)



'An example GUI script

function main()

msgbox "An example of creating a GUI with VBScript for Howler"

'this is most of the controls that the GUI object supports, not counting list and combo boxes
'each call returns the index of the control that is created.
'you can make up to 10 of each type of control, except the color box, which can have 4

'g1-g7 are variables that will recieve the index of each control, so we can access their settings later.

g1 = GUI.AddControl("Button", "First Button", 0, 0, 1, 0)
g2 = GUI.AddControl("Text", "Textbox", 10, 0, 100, 0)
g3 = GUI.AddControl("Scroller", "Scroller", 0, 0, 100, 0)
g4 = GUI.AddControl("Check", "Checkbox", 0, 0, 1, 0)
g5 = GUI.AddControl("Number", "Number", 0, 0, 100, 0)
g6 = GUI.AddControl("Line", "Line", 0, 0, 0, 0)
g7 = GUI.AddControl("Colorbox", "Colorbox", 0, 0, 0, 0)
GUI.OpenPanel

'***** this is one possible main event loop *****

'we need variables for return values
Dim idx,  retVal , retstr

While GUI.WaitOnEvent_v(retVal, retstr) >= 0
'btw, GUI.waitonevent returns the idx of what control is being utilized at this event by the user.
'a negative value of -1 or -2 means ok or cancel

 
  'we can get the settings for each control like this, using the index for the control you want to know about
    'GUI.GetSettings_v g1, retVal, retstr

    'run a function and update the screen everytime the user clicks a control.
    If idx >= 0 Then
    'call the function you want to perform
    'also refresh the screen
    End If
Wend

'close the window and finish anything up.
GUI.ClosePanel

end function