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

Forms - Elements - Hag GUI for Cobra - Static

Main Article

Forms - Elements - Hag GUI for Cobra

Forms are invisible elements that you parent other elements to. This makes it easy to move, enable, show, hide, free, etc, several elements at the same time.

It is important to only have one form enabled (use EnableForm) at a time if these forms contain text-boxes or buttons, as using tab to cycle through text-boxes or pressing enter to activate a focused button will apply to all forms at the same time.

Forms expose the following read-only variables:

form.x: Integer - Form x position
form.y: Integer - Form y position
form.enabled: Boolean - If form is enabled
form.visible: Boolean - If form is visible

Example: (For a more in-depth example of forms, see Example2D in the Examples download)


   form1 : ^forms
       button1a : ^buttons
   background: Element

   background = CreateSprite(800,600)
   CLS(ToRGBA(200,200,200), background)
   HagInit(800,600, 1)    

   form1 = CreateForm("frm1")
       button1a = CreateButton(form1, 10, 10, 100, "Hello")


   While Not KeyDown(VK_ESCAPE)




Stay Subscribed

@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.