Ok, I'm starting to work on some projects and wanted to share the extra controls as I create them. The controls I make will reside in seperate source files that can be added to any up-to-date TopGUI project.
To start with I have added a button with rounded edge and a button that is bevelled.
If Diggsey or anyone good with graphics programming knowledge can give some tips on the rounded edge buttons, please do so, because they do not look perfect; and they look worse when you use a large radius.
Button Source File
Button Snippet (v0.1) - (Excuse my browser for adding double tabs)
` TopGUI Extras - Buttons 0.1 - 04/01/12
` By Chris Tate - christate@binarymodular.com
` for Diggsey's TopGUI
`======================
function guiExtRoundedButton(id as guiId, x, y, w, h, cornerRadius, caption$)
guiLayout(id, x, y, w, h)
guiBeginControl(x, y, w, h, 1)
clicked = guiButtonLogic(id, w, h)
guiExtButtonDrawRounded(id, w, h, cornerRadius, caption$)
guiEndControl()
endfunction clicked
function guiExtBevelButton(id as guiId, x, y, w, h, bevelThickness, caption$)
guiLayout(id, x, y, w, h)
guiBeginControl(x, y, w, h, 1)
clicked = guiButtonLogic(id, w, h)
guiExtButtonDrawBevelled(id, w, h, bevelThickness, caption$)
guiEndControl()
endfunction clicked
function guiExtButtonDrawRounded(id as guiId, w, h, cornerRadius, caption$)
x = guiAdjustX(0)
y = guiAdjustY(0)
focused = guiGetFocus() = id
pressed = focused and spacekey()
cornerRadius = max(cornerRadius,1)
dblCornerRadius = cornerRadius * 2
step# = 90.0 / max(1,cornerRadius-1)
if guiGetHot() = id or pressed
if guiGetActive() = id or pressed
` Active (pressed) box area
a2FillBox x, y+cornerRadius, x+w, y+h-CornerRadius, THEME_ACTIVE_DARK, THEME_ACTIVE_DARK, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT
` Top edge
curve# = 0.0
for i = y to y+cornerRadius
offset = cos( curve# ) * cornerRadius
a2Line x + offset, i, x + w - offset, i, THEME_ACTIVE_LIGHT
a2Dot x + offset, i, THEME_OUTLINE_DARK : a2Dot x + w - offset, i, THEME_OUTLINE_DARK
inc curve#, step#
next i
` Bottom edge
curve# = 0.0
bottom1 = y + h - cornerRadius : bottom2 = y + h
for i = bottom1 to bottom2
offset = sin( curve# ) * cornerRadius
a2Line x + offset, i, x + w - offset, i, THEME_ACTIVE_DARK
a2Dot x + offset, i, THEME_OUTLINE_DARK : a2Dot x + w - offset, i, THEME_OUTLINE_DARK
inc curve#, step#
next i
else
` Hot
a2FillBox x, y+cornerRadius, x+w, y+h-CornerRadius, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT, THEME_ACTIVE_DARK, THEME_ACTIVE_DARK
` Top edge
curve# = 0.0
for i = y to y+cornerRadius-1
offset = cos( curve# ) * cornerRadius
a2Line x + offset, i, x + w - offset, i, THEME_ACTIVE_LIGHT
a2Dot x + offset, i, THEME_OUTLINE_DARK : a2Dot x + w - offset, i, THEME_OUTLINE_DARK
inc curve#, step#
next i
` Bottom edge
curve# = 0.0
bottom1 = y + h - cornerRadius : bottom2 = y + h - 1
for i = bottom1 to bottom2
offset = sin( curve# ) * cornerRadius
a2Line x + offset, i, x + w - offset, i, THEME_ACTIVE_DARK
a2Dot x + offset, i, THEME_OUTLINE_DARK : a2Dot x + w - offset, i, THEME_OUTLINE_DARK
inc curve#, step#
next i
endif
else
` Normal
a2FillBox x, y+cornerRadius, x+w, y+h-CornerRadius, THEME_INACTIVE_LIGHT, THEME_INACTIVE_LIGHT, THEME_INACTIVE_DARK, THEME_INACTIVE_DARK
` Top edge
curve# = 0.0
for i = y to y+cornerRadius
offset = cos( curve# ) * cornerRadius
a2Line x + offset, i, x + w - offset, i, THEME_INACTIVE_LIGHT
a2Dot x + offset, i, THEME_OUTLINE_DARK : a2Dot x + w - offset, i, THEME_OUTLINE_DARK
inc curve#, step#
next i
` Bottom edge
curve# = 0.0
bottom1 = y + h - cornerRadius : bottom2 = y + h
for i = bottom1 to bottom2
offset = sin( curve# ) * cornerRadius
a2Line x + offset, i, x + w - offset, i, THEME_INACTIVE_DARK
a2Dot x + offset, i, THEME_OUTLINE_DARK : a2Dot x + w - offset, i, THEME_OUTLINE_DARK
inc curve#, step#
next i
endif
a2SetLineAA 0
` Left Line
a2Line x, y+cornerRadius, x, y+h-cornerRadius, THEME_OUTLINE_DARK
` Right Line
a2Line x+w-1, y+cornerRadius, x+w-1, y+h-cornerRadius, THEME_OUTLINE_DARK
` Top Line
a2Line x+cornerRadius, y, x+w-cornerRadius, y, THEME_OUTLINE_DARK
` Bottom Line
a2Line x+cornerRadius, y+h-1, x+w-cornerRadius, y+h-1, THEME_OUTLINE_DARK
a2SetLineAA 1
`a2BoxText gui.fontId, x+4, y+4, x+w-2, y+h-2, caption$, 1, 1, 1, THEME_TEXT_SHADOW
`a2BoxText gui.fontId, x+3, y+3, x+w-3, y+h-3, caption$, 1, 1, 1, THEME_TEXT_DARK
guiFastBoxText(gui.fontId, x+4, y+4, x+w-2, y+h-2, caption$, 1, 1, 1, THEME_TEXT_SHADOW)
guiFastBoxText(gui.fontId, x+3, y+3, x+w-3, y+h-3, caption$, 1, 1, 1, THEME_TEXT_DARK)
if focused
guiDrawFocusRect(x+3, y+3, x+w-4, y+h-4, THEME_FOCUS_DARK)
endif
endfunction
function guiExtButtonDrawBevelled(id as guiId, w, h, bevelThickness, caption$)
x = guiAdjustX(0)
y = guiAdjustY(0)
focused = guiGetFocus() = id
pressed = focused and spacekey()
halfContrast = max( 1, contrast ) / 2
if guiGetHot() = id or pressed
if guiGetActive() = id or pressed
` Active (pressed)
a2FillBox x, y, x+w, y+h, THEME_ACTIVE_DARK, THEME_ACTIVE_DARK, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT
` Pressed Darkness
a2FillBox x+bevelThickness, y, x+w-bevelThickness, y+bevelThickness, THEME_SHADOW_START, THEME_SHADOW_START, THEME_SHADOW_END, THEME_SHADOW_END
a2FillBox x, y, x+bevelThickness, y+h, THEME_SHADOW_END, THEME_SHADOW_END, THEME_SHADOW_START, THEME_SHADOW_START
` Pressed Highlight
a2FillBox x+bevelThickness, y+h-bevelThickness, x+w-bevelThickness, y+h, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT, THEME_FOCUS_LIGHT, THEME_FOCUS_LIGHT
a2FillBox x+w-bevelThickness, y, x+w, y+h, THEME_FOCUS_LIGHT, THEME_FOCUS_LIGHT, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT
else
` Hot
a2FillBox x, y, x+w, y+h, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT, THEME_ACTIVE_DARK, THEME_ACTIVE_DARK
` Darkness
a2FillBox x+bevelThickness, y+h-bevelThickness, x+w-bevelThickness, y+h, THEME_SHADOW_START, THEME_SHADOW_START, THEME_SHADOW_END, THEME_SHADOW_END
a2FillBox x+w-bevelThickness, y, x+w, y+h, THEME_SHADOW_END, THEME_SHADOW_END, THEME_SHADOW_START, THEME_SHADOW_START
` Highlight
a2FillBox x+bevelThickness, y, x+w-bevelThickness, y+bevelThickness, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT, THEME_FOCUS_LIGHT, THEME_FOCUS_LIGHT
a2FillBox x, y, x+bevelThickness, y+h, THEME_FOCUS_LIGHT, THEME_FOCUS_LIGHT, THEME_ACTIVE_LIGHT, THEME_ACTIVE_LIGHT
endif
else
` Normal
a2FillBox x, y, x+w, y+h, THEME_INACTIVE_LIGHT, THEME_INACTIVE_LIGHT, THEME_INACTIVE_DARK, THEME_INACTIVE_DARK
` Darkness
a2FillBox x+bevelThickness, y+h-bevelThickness, x+w-bevelThickness, y+h, THEME_SHADOW_START, THEME_SHADOW_START, THEME_SHADOW_END, THEME_SHADOW_END
a2FillBox x+w-bevelThickness, y, x+w, y+h, THEME_SHADOW_END, THEME_SHADOW_END, THEME_SHADOW_START, THEME_SHADOW_START
` Highlight
a2FillBox x+bevelThickness, y, x+w-bevelThickness, y+bevelThickness, THEME_INACTIVE_LIGHT, THEME_INACTIVE_LIGHT, THEME_FOCUS_LIGHT, THEME_FOCUS_LIGHT
a2FillBox x, y, x+bevelThickness, y+h, THEME_FOCUS_LIGHT, THEME_FOCUS_LIGHT, THEME_INACTIVE_LIGHT, THEME_INACTIVE_LIGHT
endif
a2SetLineAA 0
a2Box x, y, x+w-1, y+h-1, THEME_OUTLINE_DARK
a2SetLineAA 1
`a2BoxText gui.fontId, x+4, y+4, x+w-2, y+h-2, caption$, 1, 1, 1, THEME_TEXT_SHADOW
`a2BoxText gui.fontId, x+3, y+3, x+w-3, y+h-3, caption$, 1, 1, 1, THEME_TEXT_DARK
guiFastBoxText(gui.fontId, x+4, y+4, x+w-2, y+h-2, caption$, 1, 1, 1, THEME_TEXT_SHADOW)
guiFastBoxText(gui.fontId, x+3, y+3, x+w-3, y+h-3, caption$, 1, 1, 1, THEME_TEXT_DARK)
if focused
guiDrawFocusRect(x+3, y+3, x+w-4, y+h-4, THEME_FOCUS_DARK)
endif
endfunction
Tester Demo
sync on : sync rate 0
set display mode desktop width(), desktop height(), 32, 0
` Initialise the GUI
guiInit()
global windowX = 750
global windowY = 100
global windowW = 400
global windowH = 400
global windowX2 = 200
global windowY2 = 50
global windowW2 = 500
global windowH2 = 600
global windowX3 = 50
global windowY3 = 300
global windowW3 = 350
global windowH3 = 400
global windowChecked1 = 0
global windowChecked2 = 0
global windowValue3 = 0
global windowText$ = "Edit me!"
global windowScrollX2
global windowScrollY2
global windowItem
global windowScrollX1
global windowScrollY1
global windowTabIndex = 1
global windowIndex3 = 0
global menuChecked = 0
global menuCheckedIndex = 0
global panelScrollX
global panelScrollY
global sliderValue
global spinnerValue as float
global spinnerValue2 as float
` These are names of functions. Each function draws a window. They are put
` in an array so that they can easily be re-ordered when a window is
` brought to the front.
dim windowFuncPtrs(2) as string
windowFuncPtrs(0) = "window2"
windowFuncPtrs(1) = "window1"
windowFuncPtrs(2) = "window3"
make camera 1
set current camera 1
set camera aspect 1, 1
set camera to image 1, 1, 300, 300, 2
color backdrop 1, 0
make object cube 1, 1
set object mask 1, %10
backdrop off 0
set current camera 0
ink 0, 0
initDBProParser()
` Declare a variable to hold the text document
myTextDocument as guiTextDocumentType
` Create a text document
guiCreateTextDocument()
` Put some text in it
guiSetTextDocumentFromString("sync on : sync rate 0" + lf$() + lf$() + "make object cube 1, 10" + lf$() + lf$() + "do" + lf$() + " myvar = 1" + lf$() + " print " + quote$("myvar: ") + ", myvar" + lf$() + " sync `Update the screen" + lf$() + "loop")
` Attach the DBPro syntax parser
guiCurrentTextDocument.parser = get ptr to function("DBProParser")
` Put the result into the text document variable
myTextDocument = guiCurrentTextDocument
dim expanded(7) as boolean
do
gameFocused = guiGame(GEN_ID, 0, 0, screen width(), screen height())
` Activate the text document
guiSetCurrentTextDocument(myTextDocument)
` Draw and update the textarea
guiTextarea(GEN_ID, 50, 50, 150, 300, scrollx, scrolly, 0)
` *IMPORTANT* Save changes to text document into variable
myTextDocument = guiCurrentTextDocument
` Update scrolling
scrollx = guiScrollX()
scrolly = guiScrollY()
guiHProgressbar(GEN_ID, 400, 200, 200, 24, (timer()/5) mod 1000, 1000, 0, 1)
guiVProgressbar(GEN_ID, 400, 250, 50, 200, (timer()/5) mod 1000, 1000, 1, 1)
guiGroupboxBegin(GEN_ID, 500, 500, 300, 300, THEME_TEXT_LIGHT, "Groupbox")
guiGroupboxEnd()
guiTreeviewBegin(GEN_ID, 30, 400, 300, 300, treescrollx, treescrolly, 24, treeIndex)
expanded(0) = guiTreenodeBegin("Root node 1", 0, expanded(0))
expanded(1) = guiTreenodeBegin("Node 1", 0, expanded(1))
guiTreenode("Child node 1", 0)
guiTreenode("Child node 2", 0)
guiTreenode("Child node 3", 0)
guiTreenode("Child node 4", 0)
guiTreenode("Child node 5", 0)
guiTreenodeEnd()
expanded(2) = guiTreenodeBegin("Node 2", 0, expanded(2))
expanded(3) = guiTreenodeBegin("Sub node 1", 0, expanded(3))
guiTreenode("Child node 1", 0)
guiTreenode("Child node 2", 0)
guiTreenode("Child node 3", 0)
guiTreenode("Child node 4", 0)
guiTreenode("Child node 5", 0)
guiTreenodeEnd()
guiTreenodeEnd()
guiTreenode("Child node 1", 0)
guiTreenode("Child node 2", 0)
guiTreenode("Child node 3", 0)
guiTreenode("Child node 4", 0)
expanded(4) = guiTreenodeBegin("Node 3", 0, expanded(4))
expanded(5) = guiTreenodeBegin("Sub node 1", 0, expanded(5))
expanded(6) = guiTreenodeBegin("Deep node 1", 0, expanded(6))
expanded(7) = guiTreenodeBegin("Deeper node 1", 0, expanded(7))
guiTreenode("Child node 1", 0)
guiTreenode("Child node 2", 0)
guiTreenode("Child node 3", 0)
guiTreenodeEnd()
guiTreenodeEnd()
guiTreenodeEnd()
guiTreenodeEnd()
guiTreenodeEnd()
treeIndex = guiTreeviewEnd()
treescrollx = guiScrollX()
treescrolly = guiScrollY()
` Draw the windows making sure they are in the correct order
guiWindowListNames(get arrayptr(windowFuncPtrs()), guiRootFocused())
` Open context menu on right click
if gui.msd = 2
menux = gui.msx
menuy = gui.msy
menuopen = 1
else
menuopen = 0
endif
` Draw context menu
if guiContextMenuBegin(GEN_ID, menux, menuy, 150, 180, menuopen)
doExampleMenu()
guiContextMenuEnd()
endif
` Update cube
yrotate object 1, hitimer()*0.02
print screen fps()
` Update GUI
guiUpdate()
sync
cls 0xFFC0D0FF
loop
function sayHello(opened)
if opened
` Initial dialog position and size
guiModal.x = 300
guiModal.y = 300
guiModal.width = 220
guiModal.height = 110
` Prevent a non-modal control from keeping the focus
guiSetFocus(0, 0, 0)
endif
if guiMessageBox(guiModal.id, "Title", "Hello, this is a message box!", guiModal.x, guiModal.y, guiModal.width, guiModal.height, guiModal.focused)
guiCloseModal()
endif
guiModal.x = guiMoveX(guiModal.x, 0, 1000000, guiModal.width, 0, 1000000)
guiModal.y = guiMoveY(guiModal.y, 0, 1000000, guiModal.height, 0, 1000000)
endfunction
` Automatically find all the DBPro keywords
function initDBProParser()
` Get DBPro install path from registry
path$ = get registry$("SOFTWARE\Dark Basic\Dark Basic Pro", "INSTALL-PATH")
path$ = path$ + "\Editor\Keywords"
` If registry key not found, try program files
if path exist(path$) = 0
path$ = dir programs() + "\The Game Creators\Dark Basic Professional\Editor\Keywords"
endif
` Open the keywords folder
set dir path$
` Put all keywords into a lookup table for speed
make lookup 1
find first
repeat
if get file type() = 0
if fast right$(get file name$(), 4) = ".ini"
open to read 1, get file name$()
read string 1, line$
while file end(1) = 0
pos = find char(line$, "=")
if pos
keyword$ = fast lower$(fast left$(line$, pos-1))
set lookup 1, keyword$, "keyword"
endif
read string 1, line$
endwhile
close file 1
endif
endif
find next
until get file type() = -1
endfunction
` Check if the text starts with a keyword and return its length
function findKeyword(text$)
text$ = fast lower$(text$)
l = fast len(text$)
for i = 1 to l
c = mid ascii(text$, i)
if guiIsLetterOrDigit(c) = 0 and c <> 32 and c <> 36
exit
endif
next i
dec i
keyword$ = text$
while i > 0
keyword$ = fast left$(keyword$, i)
if lookup exist(1, keyword$)
exitfunction i
endif
i = last instr(keyword$, " ")-1
endwhile
endfunction 0
` Check if the text starts with a word and return its length
function findWord(text$)
l = fast len(text$)
for i = 1 to l
c = mid ascii(text$, i)
if guiIsLetterOrDigit(c) = 0
dec i
exitfunction i
endif
next i
endfunction l
` Check if the text starts with symbols and return its length
function findSymbol(text$)
l = fast len(text$)
for i = 1 to l
c = mid ascii(text$, i)
if guiIsLetter(c) or c = 34 or c = 96
dec i
exitfunction i
endif
next i
endfunction l
` Check if the text starts with a quoted string and return its length
function findString(text$)
c = mid ascii(text$, 1)
if c = 34
l = find ascii(text$, 34, 2)
if l = 0 then l = fast len(text$)
else
l = 0
endif
endfunction l
` DBPro syntax parser, called for each line
function DBProParser(state, text$, colorFuncPtr)
` colorFunc must be called at least once even for an empty line
` so that the textarea knows what font to use to determine the
` line height.
if text$ = "" and colorFuncPtr <> 0
call function ptr colorFuncPtr, 0, 0, gui.fontId, ""
endif
` While the line has text left to parse
while text$ <> ""
` If we are in a multiline comment
if state
` TODO: Handle multiline comments
else
` Get first character code
c = asc(text$)
if guiIsLetter(c)
` If it's a letter check for keywords and words
keyword = findKeyword(text$)
if keyword
` It's a keyword
call function ptr colorFuncPtr, 0xFF0000FF, 0, gui.fontId, fast left$(text$, keyword)
text$ = mid$(text$, keyword+1, 0)
else
` It's a word (eg. variable name)
wordlen = findWord(text$)
call function ptr colorFuncPtr, 0xFF000000, 0, gui.fontId, fast left$(text$, wordlen)
text$ = mid$(text$, wordlen+1, 0)
endif
else
` If it's not a letter check for a symbol, quoted string or single-line comment
symbol = findSymbol(text$)
if symbol
` It's a symbol or number
call function ptr colorFuncPtr, 0xFFFF0000, 0, gui.fontId, fast left$(text$, symbol)
text$ = mid$(text$, symbol+1, 0)
else
str = findString(text$)
if str
` It's a quoted string
call function ptr colorFuncPtr, 0xFF800080, 0, gui.fontId, fast left$(text$, str)
text$ = mid$(text$, str+1, 0)
else
` It's a single-line comment, so process the rest of the line
call function ptr colorFuncPtr, 0xFF808080, 0, gui.fontId, text$
text$ = ""
endif
endif
endif
endif
endwhile
endfunction state
function doExampleMenu()
guiMenuItem("Item 0", 0, 24, 20, 0)
menuChecked = guiCheckboxMenuItem("Check me", 0, 24, 20, menuChecked)
guiSplitterMenuItem(5)
guiMenuItem("Item 2", 0, 24, 20, 0)
if guiDropDownMenuItemBegin(GEN_ID, "Set Theme", 24, 20, 0, 150, 98)
menuCheckedIndex = guiRadioButtonMenuItem("Default", 0, 24, 20, 0, menuCheckedIndex)
menuCheckedIndex = guiRadioButtonMenuItem("Red", 0, 24, 20, 1, menuCheckedIndex)
menuCheckedIndex = guiRadioButtonMenuItem("Green", 0, 24, 20, 2, menuCheckedIndex)
menuCheckedIndex = guiRadioButtonMenuItem("Blue", 0, 24, 20, 3, menuCheckedIndex)
select menuCheckedIndex
case 0
guiSetTheme("Default")
endcase
case 1
guiSetTheme("Red")
endcase
case 2
guiSetTheme("Green")
endcase
case 3
guiSetTheme("Blue")
endcase
endselect
guiDropDownMenuItemEnd()
endif
guiMenuItem("Item 3", 0, 24, 20, 0)
guiMenuItem("Item 4", 0, 24, 20, 0)
guiSplitterMenuItem(5)
if guiMenuItem("Dialog", 0, 24, 20, 0)
guiOpenModalName(RND_ID, 0, "sayHello", 0)
endif
endfunction
function window1(focused)
clicked = guiWindowBegin(GEN_ID, windowX, windowY, windowW, windowH, "Hello world!", 0, focused)
if guiButton(GEN_ID, 230, 50, 150, 25, "Normal Button")
guiMessageBox(GEN_ID, "Alert", "Button clicked", Screen Width() / 2, Screen Height() / 2, 300, 150, 1 )
Endif
if guiExtRoundedButton(GEN_ID, 230, 100, 150, 25, 4, "Round Button")
guiMessageBox(GEN_ID, "Alert", "Button clicked", Screen Width() / 2, Screen Height() / 2, 300, 150, 1 )
Endif
if guiExtRoundedButton(GEN_ID, 230, 150, 150, 100, 4, "Big Round Button")
guiMessageBox(GEN_ID, "Alert", "Button clicked", Screen Width() / 2, Screen Height() / 2, 300, 150, 1 )
Endif
if guiExtBevelButton(GEN_ID, 230, 300, 150, 25, 4, "Bevel Button")
guiMessageBox(GEN_ID, "Alert", "Button clicked", Screen Width() / 2, Screen Height() / 2, 300, 150, 1 )
Endif
guiMenuBegin(GEN_ID, 0, 0, windowW-8, 24)
if guiDropDownMenuItemBegin(GEN_ID, "File", 24, 0, 0, 150, 180)
doExampleMenu()
guiDropDownMenuItemEnd()
endif
if guiDropDownMenuItemBegin(GEN_ID, "Edit", 24, 0, 0, 150, 180)
doExampleMenu()
guiDropDownMenuItemEnd()
endif
if guiDropDownMenuItemBegin(GEN_ID, "View", 24, 0, 0, 150, 180)
doExampleMenu()
guiDropDownMenuItemEnd()
endif
guiMenuEnd()
windowChecked1 = guiCheckbox(GEN_ID, 20, 40, 120, 30, "Check me", windowChecked1)
guiListboxBegin(GEN_ID, 20, 100, 200, 200, windowScrollX1, windowScrollY1, 0, 1)
for i = 0 to 10
if guiListboxItem("Item "+str$(i), i mod 3, windowItem = i) then windowItem = i
next i
guiListboxEnd()
windowScrollX1 = guiScrollX()
windowScrollY1 = guiScrollY()
guiWindowEnd()
windowX = guiMoveX(windowX, 0, 1000000, windowW, 50, 1000000)
windowY = guiMoveY(windowY, 0, 1000000, windowH, 50, 1000000)
windowW = guiResizeW(windowW)
windowH = guiResizeH(windowH)
endfunction clicked
function window2(focused)
windowId = GEN_ID
clicked = guiScrollWindowBegin(windowId, windowX2, windowY2, windowW2, windowH2, "Hello World!", windowScrollX2, windowScrollY2, 1000, 1000, 0, focused)
windowChecked2 = guiRadioButton(GEN_ID, 100, 40, 120, 30, "Check me", 0, windowChecked2)
windowChecked2 = guiRadioButton(GEN_ID, 100, 80, 120, 30, "Check me", 1, windowChecked2)
windowChecked2 = guiRadioButton(GEN_ID, 100, 120, 120, 30, "Check me", 2, windowChecked2)
windowChecked2 = guiRadioButton(GEN_ID, 100, 160, 120, 30, "Check me", 3, windowChecked2)
guiTabsBegin(GEN_ID, 100, 200, 308, 332, 25, windowTabIndex)
if guiTabBegin("Tab 0", 0)
guiBeginGridLayout(0, 0, 29, 29, -2, -2)
if guiButton(GEN_ID, 0, 0, 10, 1, "Click me!")
guiOpenModalName(RND_ID, windowId, "sayHello", 0)
endif
if guiButton(GEN_ID, 0, 1, 3, 2, "Click me!")
guiOpenModalName(RND_ID, windowId, "sayHello", 0)
endif
guiButton(GEN_ID, 6, 1, 3, 3, "Hi")
guiButton(GEN_ID, 5, 4, 5, 2, "Hi")
guiButton(GEN_ID, 7, 7, 3, 3, "Fill")
guiEndGridLayout()
guiTabEnd()
endif
if guiTabBegin("Tab 1", 0)
a2DrawImage 1, guiAdjustX(0), guiAdjustY(0), 0, 0, 0, 1, 0, 0xFFFFFFFF
guiTabEnd()
endif
if guiTabBegin("Tab 2", 0)
windowText$ = guiPassbox(GEN_ID, 20, 20, 150, 25, windowText$, chr$(149), 0)
guiTabEnd()
endif
windowTabIndex = guiTabsEnd()
guiScrollPanelBegin(GEN_ID, 500, 100, 300, 300, panelScrollX, panelScrollY, 0, 1, 1)
if guiButton(GEN_ID, 200, 300, 200, 50, "Click me!")
endif
guiScrollPanelEnd(600, 600)
panelScrollX = guiScrollX()
panelScrollY = guiScrollY()
sliderValue = guiHSlider(GEN_ID, 500, 500, 300, 30, sliderValue, 15, 1)
sliderValue = guiVSlider(GEN_ID, 500, 550, 30, 300, sliderValue, 15, 1)
spinnerValue = guiSpinner(GEN_ID, 600, 600, 100, 25, spinnerValue, -100.0, 100.0, 0.05, 2, 1)
spinnerValue2 = guiSpinner(GEN_ID, 600, 630, 100, 25, spinnerValue2, -100.0, 100.0, 0.05, 2, 1)
guiScrollWindowEnd()
windowX2 = guiMoveX(windowX2, 0, 1000000, windowW2, 50, 1000000)
windowY2 = guiMoveY(windowY2, 0, 1000000, windowH2, 50, 1000000)
windowW2 = guiResizeW(windowW2)
windowH2 = guiResizeH(windowH2)
windowScrollX2 = guiScrollX()
windowScrollY2 = guiScrollY()
endfunction clicked
function window3(focused)
clicked = guiWindowBegin(GEN_ID, windowX3, windowY3, windowW3, windowH3, "Hello world!", 0, focused)
windowValue3 = guiHScrollbar(GEN_ID, 30, 30, 250, 21, windowValue3, 100, 20, 5)
windowValue3 = guiVScrollbar(GEN_ID, 30, 60, 21, 250, windowValue3, 100, 20, 5)
windowText$ = guiTextbox(GEN_ID, 60, 60, 150, 25, windowText$, 0)
guiLabel(GEN_ID, 60, 100, 100, 50, "Some text on a label.", 1, 1, 0xFFFFFFFF)
guiComboboxBegin(GEN_ID, 60, 200, 150, 21, windowIndex3, 100, 1)
guiComboboxItem("Hello", 20, 0)
guiComboboxItem("world!", 20, 1)
guiComboboxItem("Another item", 20, 1)
guiComboboxItem("Item 4", 20, 1)
guiComboboxItem("Item 5", 20, 1)
guiComboboxItem("Item 6", 20, 1)
guiComboboxItem("Item 7", 20, 1)
windowIndex3 = guiComboboxEnd()
guiWindowEnd()
windowX3 = guiMoveX(windowX3, 0, 1000000, windowW3, 50, 1000000)
windowY3 = guiMoveY(windowY3, 0, 1000000, windowH3, 50, 1000000)
windowW3 = guiResizeW(windowW3)
windowH3 = guiResizeH(windowH3)
endfunction clicked
end
