Buttons - Elements - Hag GUI for Cobra
Buttons are rectangular GUI elements that, when clicked, perform an action.
Buttons expose the following read-only variables:
button.x: Integer - Button x position
button.y: Integer - Button y position
button.w: Integer - Button width
button.h: Integer - Button height
button.enabled: Boolean - If button is enabled
button.visible: Boolean - If button is visible
button.isImageButton: Boolean - If button is an Image Button
Example:
Program
Uses
cobra2D,
keyset,
hagC2D
Var
form1 : ^forms
button1a : ^buttons
background: Element
Begin
OpenScreen(800,600,32,FALSE,COB_SHOWBORDER)
background = CreateSprite(800,600)
CLS(ToRGBA(200,200,200), background)
HagBaseDir("hag\")
HagInit(800,600, 1)
HagLoadGuiTheme("xp")
form1 = CreateForm("frm1")
button1a = CreateButton(form1, 10, 10, 100, "Hello")
HagUpdateOnce()
While Not KeyDown(VK_ESCAPE)
HagUpdateAll_AutoKeys()
Flip
Pause(1)
Wend
HagFreeAll()
CloseScreen
End
Uses
cobra2D,
keyset,
hagC2D
Var
form1 : ^forms
button1a : ^buttons
background: Element
Begin
OpenScreen(800,600,32,FALSE,COB_SHOWBORDER)
background = CreateSprite(800,600)
CLS(ToRGBA(200,200,200), background)
HagBaseDir("hag\")
HagInit(800,600, 1)
HagLoadGuiTheme("xp")
form1 = CreateForm("frm1")
button1a = CreateButton(form1, 10, 10, 100, "Hello")
HagUpdateOnce()
While Not KeyDown(VK_ESCAPE)
HagUpdateAll_AutoKeys()
Flip
Pause(1)
Wend
HagFreeAll()
CloseScreen
End
Stay Subscribed
RSS feed or get updates by e-mail.
, subscribe to theYou can also contact me directly - I make an effort to reply to every e-mail.