Difference between revisions of "Gambas/controls/Form"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(some answers)
(events - moved from qt library page; doc link; clarified dimension properties)
 
Line 9: Line 9:
 
* '''Y''' - top edge of form relative to top of screen, in pixels
 
* '''Y''' - top edge of form relative to top of screen, in pixels
 
** When window is at top of screen, this will show the width of the window's titlebar
 
** When window is at top of screen, this will show the width of the window's titlebar
* '''W''' - width in pixels
+
* '''W''' / '''Width''' - width in pixels
* '''H''' - height in pixels
+
* '''H''' / '''Height''' - height in pixels
* '''Width''' - alias for W?
+
* '''ClientX''' - position of top edge of area containing the controls (read-only)
* '''Height''' - alias for H?
+
* '''ClientY''' - position of left edge of area containing the controls (read-only)
* '''ClientX''' - always 0?
+
* '''ClientW''' / '''ClientWidth''' - width of area containing the controls (read-only)
* '''ClientY''' - always 0?
+
* '''ClientH''' / '''ClientHeight''' - height of area containing the controls (read-only)
* '''ClientW''' - alias for W?
 
* '''ClientH''' - alias for H?
 
* '''ClientWidth''' - alias for W?
 
* '''ClientHeight''' - alias for H?
 
 
| valign=top |
 
| valign=top |
 
===Methods===
 
===Methods===
Line 42: Line 38:
 
* ShowPopup
 
* ShowPopup
 
|}
 
|}
 +
==Events==
 +
===state-change===
 +
* '''Open'''() and '''Show'''() are both called before the form has displayed
 +
* '''Activate'''() is called when the form gets focus (title bar changes color, in most color schemes)
 +
* '''Enter'''() is called whenever the mouse enters the drawing region of the form (menu bar & frame aren't included)
 +
* '''Leave'''() is called whenever the mouse leaves the drawing region of the form
 +
* '''Deactivate'''() is called whenever the form loses focus
 +
* nothing seems to trigger '''GotFocus'''() and '''LostFocus'''(); perhaps these are only used for controls (suggests the inheritance structure isn't set up quite right)
 +
* '''Unknown''':
 +
** '''Arrange'''()
 +
** '''BeforeArrange'''() - presumably related to Arrange()
 +
 +
Unfortunately, there doesn't seem to be any event which is called exactly ''once'', ''after'' the form is visible; the best [[kluge]] seems to be to put any such code in the '''Activate''' event and check/set a flag so it only gets called once.
 +
==Links==
 +
===Official===
 +
* [http://gambaswiki.org/wiki/comp/gb.qt4/form Form (gb.qt4)]

Latest revision as of 20:36, 26 April 2015

About

Form is a control defined in the gb.gui library.

Properties

dimensions

  • X - left edge of form relative to left of screen, in pixels
  • Y - top edge of form relative to top of screen, in pixels
    • When window is at top of screen, this will show the width of the window's titlebar
  • W / Width - width in pixels
  • H / Height - height in pixels
  • ClientX - position of top edge of area containing the controls (read-only)
  • ClientY - position of left edge of area containing the controls (read-only)
  • ClientW / ClientWidth - width of area containing the controls (read-only)
  • ClientH / ClientHeight - height of area containing the controls (read-only)

Methods

  • Center
  • Close
  • Delete
  • Drag
  • FindChild
  • Grab
  • Hide
  • Lower
  • Move
  • MoveScaled
  • Raise
  • Refresh
  • Reparent
  • Resize
  • ResizeScaled
  • SetFocus
  • Show
  • ShowDialog
  • ShowModal
  • ShowPopup

Events

state-change

  • Open() and Show() are both called before the form has displayed
  • Activate() is called when the form gets focus (title bar changes color, in most color schemes)
  • Enter() is called whenever the mouse enters the drawing region of the form (menu bar & frame aren't included)
  • Leave() is called whenever the mouse leaves the drawing region of the form
  • Deactivate() is called whenever the form loses focus
  • nothing seems to trigger GotFocus() and LostFocus(); perhaps these are only used for controls (suggests the inheritance structure isn't set up quite right)
  • Unknown:
    • Arrange()
    • BeforeArrange() - presumably related to Arrange()

Unfortunately, there doesn't seem to be any event which is called exactly once, after the form is visible; the best kluge seems to be to put any such code in the Activate event and check/set a flag so it only gets called once.

Links

Official