1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
| ;
; ------------------------------------------------------------
;
; SpiderBasic - Complex dialog example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
Enumeration
#Dialog
#Dialog2
#Dialog3
EndEnumeration
#Xml = 0
; Declare this enumeration as 'Runtime' so we can use the constants directly in the XML
;
Runtime Enumeration Gadget
#ListView
#GeneralContainer
#EditorContainer
#BackupContainer
EndEnumeration
Procedure ShowPanels()
HideGadget(#GeneralContainer, #True)
HideGadget(#EditorContainer, #True)
HideGadget(#BackupContainer, #True)
Select GetGadgetState(#ListView)
Case 0
HideGadget(#GeneralContainer, #False)
Case 1
HideGadget(#EditorContainer, #False)
Case 2
HideGadget(#BackupContainer, #False)
EndSelect
EndProcedure
; Declare this procedure as 'Runtime' so we can use it as an event handler directly in the XML
;
Runtime Procedure OnListViewEvent()
ShowPanels()
EndProcedure
Procedure CreateDialogGeneric(Dialog, XML$, x, y)
If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(Dialog) And OpenXMLDialog(Dialog, #Xml, "test", x, y) = #False
Debug "Dialog error: " + DialogError(Dialog)
EndIf
Else
Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
EndProcedure
XML$ = "<window id='#PB_Any' name='test' text='Preferences' minwidth='auto' minheight='auto' flags='#PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <hbox expand='item:2'>" +
" <listview id='#ListView' width='100' onevent='OnListViewEvent()'/>" +
" <multibox>" +
"" +
" <container id='#GeneralContainer'>" +
" <frame text='General'>" +
" <vbox expand='no'>" +
" <checkbox text='Enable red light'/>" +
" <checkbox text='Enable green light'/>" +
" </vbox>" +
" </frame>" +
" </container>" +
"" +
" <container id='#EditorContainer'>" +
" <frame text='Editor'>" +
" <vbox expand='no'>" +
" <checkbox text='Set read only mode'/>" +
" <checkbox text='Duplicate line automatically'/>" +
" <checkbox text='Enable monospace font'/>" +
" </vbox>" +
" </frame>" +
" </container>" +
"" +
" <container id='#BackupContainer'>" +
" <frame text='Backup'>" +
" <vbox expand='no'>" +
" <checkbox text='Activate backup'/>" +
" </vbox>" +
" </frame>" +
" </container>" +
"" +
" </multibox>" +
" </hbox>" +
"</window>"
CreateDialogGeneric(#Dialog2, XML$, 10, 10)
AddGadgetItem(#ListView, -1, "General")
AddGadgetItem(#ListView, -1, "Editor")
AddGadgetItem(#ListView, -1, "Backup")
SetGadgetState(#ListView, 0)
ShowPanels()
XML$ = "<window id='#PB_Any' name='test' text='All Gadgets' minwidth='400' minheight='auto' flags='#PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <panel>" +
" <tab text='First tab'>" +
" <vbox>" +
" <hbox>" +
" <button text='button'/>" +
" <editor text='editor'/>" +
" <hyperlink text='hyperlink'/>" +
" </hbox>" +
" <hbox>" +
" <date text='date'/>" +
" <checkbox text='checkbox'/>" +
" <option text='option'/>" +
" <trackbar/>" +
" </hbox>" +
" <hbox>" +
" <canvas text='date' flags='#PB_Canvas_Border'/>" +
" <calendar text='checkbox'/>" +
" <listview text='combo'/>" +
" <web text='http://www.purebasic.com'/>" +
" </hbox>" +
" <hbox>" +
" <image text='date' flags='#PB_Image_Border'/>" +
" <progressbar/>" +
" <combobox text='combo'/>" +
" <text text='Text'/>" +
" </hbox>" +
" <hbox>" +
" <scrollarea flags='#PB_ScrollArea_Border'/>" +
" <listicon height='80' text='ListIcon'/>" +
" <frame text='Frame'/>" +
" <tree/>" +
" </hbox>" +
" <hbox>" +
" <container flags='#PB_Container_Flat'/>" +
" <string text='StringGadget'/>" +
" <spin/>" +
" </hbox>" +
" <hbox>" +
" <splitter flags='#PB_Splitter_Vertical'>" +
" <button text='Left'/>" +
" <button text='Right'/>" +
" </splitter>" +
" <buttonimage/>" +
" <panel width='100'>" +
" <tab text='1'/>" +
" <tab text='2'/>" +
" <tab text='3'/>" +
" </panel>" +
" </hbox>" +
" </vbox>" +
" </tab>" +
" </panel>" +
"</window>"
CreateDialogGeneric(#Dialog3, XML$, 370, 10) |