![]() GUI Server Reference making it easy to create user interfaces |
![]() |
|||||||
|
|
||||||||
|
||||||||
|
|
||||||||
| An easy and convenient way
to make special FX filters with user interactions like
buttons, menus, sliders... |
||||||||
Overview - Download - Reference | also: DogLua - SDK |
|
Reference Look at the above examples and you'll quickly realize how easy and straight-forward it is to make a user interface for Lua scripts or other plugins and programs with user-selectable parameters and input when they use the GUI server. Below is a description of the functionality offered through the GUI server's API. Also look for examples and details at http://mark0.net/plugins-doglua-ref3.html Others may follow soon, such as Artweaver at www.artweaver.de This information is for programming the GUI_Server component. It is an ActiveX compatible software interface. Any program that can access ActiveX components should be able to program the GUI server. Button Types (specified as a text string)These are the types of controls that can be created and used. Typically it starts with AddControl to create a control of a type listed here, and receive a handle to that created control (slider, button, ...) Button (a button)
Scroller (a horizontal scrollbar) Check (a checkbox) Text (a text box) Number (a text box that only accepts numbers) TextLabel (a text string to provide information to the user. It's not editable by the user, and doesn't return an event) ComboBox (a combobox that can have multipe items in a dropdown menu) ColorBox (a color selector or "swatch") Line (a simple separator. It has no events and isn't editable by the user) Example in DogLua: --
create a checkbox labelled 'inverted' and receive its
handle in variable h1
-- the initial value (state) is checked (1) h1 = GUI_AddControl("Check", "inverted", 1) Functions or "Methods":AddControl AddControl(ControlType As String, Text As String, Value As Long, Min As Long, Max As Long, Flags As Long) As Long this function returns the index of a control that is added. You can use the returned index to reference these controls in the future. Addcontrol adds a control of a named type to the panel. ControlType. The
name of the control type you want to create and add
(as a string)
Text. The text (label) you want displayed in or near your control if supported. A caption. Value. The initial value for the control, if supported. Min/Max. If supported, the min and max values of the control. Use this with the scroller (slider) control. Flags. Allows additional settings. Currently undefined. AddLogo AddLogo(Filename As String) Adds a bitmap to the top of your panel for a logo. It should be added before any control. The filename specifies the name of the bmp file. Jpegs, tiffs, and gifs are also somewhat supported. (not with all their respective refined options). SetCaption SetCaption(Title As String) specifies a string for the title in the panels titlebar. This can be added at any time, before or after opening the panel. Example in DogLua: --you
can set the caption of the panel at any time...
GUI_SetCaption("DogLua
Test")
OpenPanel / ClosePanel When all of your conrols have been added, you can open your panel with OpenPanel. It will then be visible to the user. Once opened, you should wait for events from it with the WaitOnEvents function. When you are finished with the panel and have read all the settings that you require, you can close it with ClosePanel. This frees the GUI_Server program from memory. Example in DogLua: --
ready to show the panel:
GUI_OpenPanel() .... -- all done, bye bye now GUI_ClosePanel() WaitOnEvent WaitOnEvent (ByRef Returned_Value As Long, ByRef Returned_String As String) As Long Waits for an event to occur. Call this in a loop after your panel is setup and opened. If Ok or Cancel was pressed, the value returned by the function will be a negative number, -1 if Ok, and -2 if Cancel. Otherwise, it will be the index (handle) of the control that generated the event. There are two variables that you pass to the function. They can be empty. They are used to return additional information. Returned_Value will receive any value that is generated by the control that caused the event. If the control does not generate a numerical value, then it will be returned as a string. the text control is an example of a control that returns a string instead of a value. Example in DogLua: repeat idx, retval, retstr = GUI_WaitOnEvent() ... until idx < 0 GetSettings GetSettings(Index As Long, ByRef Returned_Value As Long, ByRef Returned_String As String) GetSettings will return settings from a control that generated an event. If you want to get settings from other controls, you can use GetSettings. Index is the index of the control you want to set. Returned_value will recieve the numeric value of this control, if any. Otherwise, Returned_String will be filled. SetSettings SetSettings(Index As Long, ByRef Set_Value As Long, ByRef Set_String As String) Use this function to set attributes to a control after it has been created. You may sometimes want to programatically change the values of a control. SetList SetList(Index As Long, element As
Long, ByRef Set_List As String)
For combo boxes, you can set multiple items in a list. Here, Index is the index of the control. Element is the number of the item on the list, starting at 0. Set_List is the text string that will appear on the list. To set the currently sellected text string for a combo box, use SetSettings. be sure to do it after the list is settup or it will be overwritten. |
|
|
|
|