there is only one drawback, the fact that you need PRIVATE variables, since we need to access objects from the ON INIT function....
Code: Select all
/*
HMG 4 DEMO
(c) 2010 Roberto Lopez <mail.box.hmg@gmail.com>
*/
#include "../../include/hmg.ch"
#include "hbqtgui.ch"
Function Main
qL := NIL
qW := NIL
o1 := NIL
o2 := NIL
Define Window oWindow ;
At 20 , 10 ;
Width 1000 ;
Height 550 ;
Title 'QFormLayout test' ;
Main ;
On Init { || proviamo(oWindow) }
qW := Widget():New()
With Object o1 := textbox():New()
:Parent := qW
:Value := 'this is a textbox'
End With
With Object o2 := DatePicker():New()
:Parent := qW
End With
With Object o3 := CheckBox():New()
:Parent := qW
:Value := .F.
End With
With Object o4 := EditBox():New()
:Parent := qW
:Value := "this is a long text, in a editbox"
End With
With Object o5 := ComboBox():New()
:Parent := qW
:items := { "item 1", "item 2", "item 3" }
End With
With Object o6 := MonthCalendar():New()
:Parent := qW
End With
With Object o7 := Slider():New()
:Parent := qW
End With
With Object o8 := ProgressBar():New()
:Parent := qW
End With
With Object o9 := grid():New()
:Parent := qW
:Row := 3
:Col := 3
:ColumnHeaders := { "h1", "h2", "h3" }
:items := { { "row 1", "row 2", "row 3" }, { "c1" ,"c2", "c3"} }
End With
qW:CentralWidgetOf( oWindow )
End Window
Activate Window oWindow
Return
function proviamo( o )
qL := QFormLayout()
qL:addRow( "Field of a long long label:", o1:oQTObject )
qL:addRow( "Field1:", o2:oQTObject )
qL:addRow( "CheckBox:", o3:oQTObject )
qL:addRow( "Field4:", o4:oQTObject )
qL:addRow( "ComboBox:", o5:oQTObject )
qL:addRow( "MonthCalendar:", o6:oQTObject )
qL:addRow( "Slider:", o7:oQTObject )
qL:addRow( "ProgressBar:", o8:oQTObject )
qL:addRow( "Grid:", o9:oQTObject )
o9:AddItem( { "1", "2","3" } )
o9:oQTObject:setRowCount( 3 )
o9:oQTObject:setColumnWidth( 0, 55 )
o9:oQTObject:setColumnWidth( 1, 85 )
o9:oQTObject:setColumnWidth( 2, 115 )
qW:oQTObject:setLayout( qL )
return .T.