[Gambas-user] Two question on creating a form with controls from code

Bruce bbruen at ...2308...
Sat Aug 25 23:30:53 CEST 2012


On Sat, 2012-08-25 at 23:01 +0200, Willy Raets wrote:
> Hi,
> 
> I've been playing with creating forms from code and run into a few
> problem. Gambas documentation doesn't provide me the answer.
> 
> 1. In IDE you have a form property Scaled (just below resizable) that
> can be set to True or False (see attached screenshot).
> When creating a form from code it seems impossible to set the Scaled
> property. Looked for it in the documentation but can't seem to find
> anything, or did I miss something?
> 
Property Scaled As Boolean
If the form and controls dimensions must follow the size of the default
font.
!	 This property is virtual: it is only implemented in the IDE, and has
no existence at runtime.

> Example
> 
> Dim FrmTest As New Form
> With FrmTest
>     .Caption = "Test form"
>     .AutoResize = False
>     .Height = 360
>     .Width = 580
>     .TopOnly = True
>     .Scaled = False    '<==== this doen't work, so how does it work?
>     .Center
>     .Show
>  End With
> 
> 2. Font documentation is very unclear on how to set a font on a control
> created from code.
> http://www.gambasdoc.org/help/comp/gb.qt4/control/font?v3
> 
> Example:
> 
> Dim FrmTest As New Form
> Dim lblTest As Label
> lblTest = New Label(FrmTest)
> With lblTest
>    .Height = 20
>    .Width = 80
>    .X = 10
>    .Y = 10
>    .Text = "Text on Label test"
>    .Font    '<=== How do I set the font for example to MonoSans, 10 pt?
> End With
> 
> Someone any hints, examples or links to a solution?
> 
  Me.Font = Font["Fudd,11"]
Check the "This class acts like a read-only array." link in the Font
class help

hth
Bruce






More information about the User mailing list