This content is provided AS IS for archive purposes only. Content may be out of date with no guarantee of correctness.

Buttons - Elements - Hag GUI for Cobra - Static

Main Article

Buttons - Elements - Hag GUI for Cobra

A button from the XP theme with the hover state.

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

  

Stay Subscribed

Follow me on twitter @golightlyb, subscribe to the RSS feed or get updates by e-mail.

You can also contact me directly - I make an effort to reply to every e-mail.


Login
v0.34.archive