Difference between revisions of "Gambas/libraries/gb.qt"

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
m (Reverted edits by 78.157.143.161 (Talk); changed back to last version by Woozle)
(moved form-state events to Form page)
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Navigation==
+
==About==
<section begin=navbar />{{#lst:Gambas reference|navbar}}: [[gb.qt]]<section end=navbar />
+
{{l/same|gb.qt}} is a [[Gambas]] [[../|library]] which provides functions for displaying and handling [[form (GUI)|form]]s; it uses the [[Qt]] graphical library.
  
==Overview==
+
Related libraries:
[[gb.qt]] is a [[Gambas]] [[library (programming)|library]] which provides functions for displaying and handling [[form (GUI)|form]]s; it uses the [[Qt]] graphical library.{{seedling}}There is also a [[gb.gtk]] component which does much the same but using the [[GTK+]] graphical library, but it appears to be less fully implemented.
+
* {{l/same|gb.qt4}} is (presumably) specific to version 4 of Qt
 +
* {{l/same|gb.gtk}} provides much of the same functionality using the [[GTK+]] graphical library, but it appears to be less fully implemented
 +
* {{l/same|gb.gui}} provides functionality common to GTK+ and Qt, and loads whichever system is currently in use
 
==Events==
 
==Events==
===form display events===
+
===form state===
* '''Open'''() and '''Show'''() are both called before the form has displayed
+
''see [[Gambas/controls/Form]]''
* '''Activate'''() is called when the form gets focus (title bar changes color, in most color schemes)
+
===drag-drop===
* '''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)
 
 
 
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.
 
===drag-drop events===
 
 
Some rules which seem to apply:
 
Some rules which seem to apply:
* The [[gb.qt.Mouse|Mouse]] location (Mouse.X and Mouse.Y) is not updated while the mouse is dragging anything; you get the mouse's location while dragging from the [[gb.qt.Drag|Drag]] object.
+
* The {{l/sub|Mouse}} location (Mouse.X and Mouse.Y) is not updated while the mouse is dragging anything; you get the mouse's location while dragging from the {{l/sub|Drag}} object.
 
* Normal mouse events are also not triggered while the mouse is dragging anything
 
* Normal mouse events are also not triggered while the mouse is dragging anything
 
* In order for any element (form or control) to receive mouse events while the mouse is dragging anything, the element's '''Drop''' property must be set to TRUE
 
* In order for any element (form or control) to receive mouse events while the mouse is dragging anything, the element's '''Drop''' property must be set to TRUE

Latest revision as of 20:37, 26 April 2015

About

gb.qt is a Gambas library which provides functions for displaying and handling forms; it uses the Qt graphical library.

Related libraries:

  • gb.qt4 is (presumably) specific to version 4 of Qt
  • gb.gtk provides much of the same functionality using the GTK+ graphical library, but it appears to be less fully implemented
  • gb.gui provides functionality common to GTK+ and Qt, and loads whichever system is currently in use

Events

form state

see Gambas/controls/Form

drag-drop

Some rules which seem to apply:

  • The Mouse location (Mouse.X and Mouse.Y) is not updated while the mouse is dragging anything; you get the mouse's location while dragging from the Drag object.
  • Normal mouse events are also not triggered while the mouse is dragging anything
  • In order for any element (form or control) to receive mouse events while the mouse is dragging anything, the element's Drop property must be set to TRUE
  • To get continuous updates on the mouse's movements, implement (control).DragMove and (form).DragMove. The control will only receive events while the mouse is inside it; the form will only receive events while the mouse is not inside another drop-enabled control. Use the form events to detect when the mouse has left the control area.

Links