2.2 QHTML Manual : Interaction with widgets

The description record of the window defines :

This section will describe how the state of the widgets can be dynamically changed. Changing the geometry of the window is made by using the placeholder widget, and will not be detailed here.

To modify the state of a widget, we first need to have a mean of referencing this widget. This is done by giving an unbound variable to the handle parameter of the widget description :

 
local  
  B
  Desc=toplevel(button(value:"One" handle:B))
  Window={QHTML.build Desc}
in  
  {Window show}
  {B set(value:"Two")}
end

While building the window, all handle variables are bound to objects that grant control over the corresponding widgets. These objects have interfaces depending on the nature of the widgets they are controlling. However these interfaces were made as uniform as possible and contain at least the following methods:

Several parameters can be set or get in a single command :

{B set(value:"Three" backgroundColor:red)}

See the specific widget documentation to see what are the parameters and what type is their value.

Another way of getting an handle is to use the feature parameter :

local  
  Desc=toplevel(button(value:"One" feature:button))
  Window={QHTML.build Desc}
in  
  {Window show}
  {Window.button set(value:"Two")}
end

This is strictly equivalent to the previous example. Instead of using a variable, this method uses a feature of the parent object. Using handles or features is just a matter of taste as both methods are equivalent.


Donatien Grolaux
Version 1.3.0 (20010902)