Page 91 of 106

Re: Welcome to the Project Developers' Table

Posted: Mon Nov 08, 2010 11:06 pm
by Carlos Britos
mrduck wrote:
Carlos Britos wrote: Hi Francesco, Rathinagiri
Testing the demo3b.prg I have an object (size 100 x 30) over the toolbar buttons and they don't work ok,
I put this to the code at line 62 and seems to work.
::oQTObject:resize( 0, 0 )
::oQTObject:move( 0,0 )
Can you check this please ? Thanks.
Sorry Carlos, I don't understand....to test demo3b you must click on one of the buttons before moving the toolbar.
at line 62 you move resize and move L2...
In the sample demo3b the transparent widget is over part of the toolbarbuttons. Is defined by default at 0,0,100,30. So the mouse is not working in this area.
Maybe I'm not understanding the widget functionality.
Is this a container for controls, like an internal window ?
If yes, then we have to set row col width height to the widget and row col of controls make reference to the widget and not to the main window.
If we set row col width height to 0, we can keep the control reference to main window.

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 12:33 am
by mrduck
Carlos Britos wrote: In the sample demo3b the transparent widget is over part of the toolbarbuttons. Is defined by default at 0,0,100,30. So the mouse is not working in this area.
I can't replicate the problem. Is it before or after you pressed a button in the toolbar ?
Maybe I'm not understanding the widget functionality.
Is this a container for controls, like an internal window ?
Widget (internally is a Qt QWidget) is a "container". Its use in demo_3b is to "contain" all the form objects (now there is only a label) so that the objects are moved when the toolbar is moved.
If you have a container QWidget you can put this widget in a layout, on a tab page, etc, opening a lot of possibilities for new GUIs.
If yes, then we have to set row col width height to the widget and row col of controls make reference to the widget and not to the main window.
Yes, coordinates are relative to the widget, not "absolute" to the window.

If we set row col width height to 0, we can keep the control reference to main window.

I want to be clear: I like the widget thing because Ihave in mind a GUI and I'm trying to do it with HMG and to be compatble with hmg-3. I'm trying to add functionalities.
You don't have to use it !
But if you don't use the widget, your coordinates are "absolute" and use the toolbar, please set the toolbar as not moveable, otherwise there will be blank space on the top....

I want to add: using coordinates, width/height in Qt is not the best way to use the library. Perhaps the best way is to use Layouts, with minwidht/minheight properties. In this way all the form can be rescaled and Qt takes care of it...

I will try to produce a demo..

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 1:51 am
by Carlos Britos
mrduck wrote:
I can't replicate the problem. Is it before or after you pressed a button in the toolbar ?

I will try to produce a demo..
The problem is before and after.
Thanks for the explanation.

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 5:58 am
by Rathinagiri
Hi Francesco & Carlos,

The problem might be because of the little QLabel hiding at #1566 of source/window.prg. I have used this label as a default background layer for showing graph and draw commands. However, the size of the same is 0,0.

Code: Select all

   //  Creating a label control as the background layer to show the graph.
   ::oGraphLabel := QLabel( ::oQTObject )
   ::oGraphLabel:resize( 0, 0 )
   ::oGraphLabel:move( 5,25 )

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 6:19 am
by Rathinagiri
Now, I have problem only when I place the toolbar in the left hand side of the window. Once I place the window in the LHS, I could not detach it.

Otherwise, widget is so cool. :) Because,
I want to add: using coordinates, width/height in Qt is not the best way to use the library. Perhaps the best way is to use Layouts, with minwidht/minheight properties. In this way all the form can be rescaled and Qt takes care of it...

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 9:45 am
by Carlos Britos
rathinagiri wrote:Hi Francesco & Carlos,

The problem might be because of the little QLabel hiding at #1566 of source/window.prg. I have used this label as a default background layer for showing graph and draw commands. However, the size of the same is 0,0.
I don't think so, because the demo in samples/toolbar without widget is normal.
I made a video to show the problem but in .avi and is very heavy, any idea how to convert it to light ?

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 10:16 am
by Rathinagiri
Using GIMP GAP you can convert into animated gif.

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 12:31 pm
by Rathinagiri

Code: Select all

2010-11-09 17:50 UTC+0530 Rathinagiri (<srgiri@dataone.in>)
  * source/window.prg
    * Implemented SET REGION OF <Window> RECTANGULAR/ELLIPTIC/POLYGONAL
  + samples/region/*.* 
    * Sample for set region/reset region  
I have a RTE with polygon. Francesco, can you help? Please see window.prg->setRegion method.

Re: Welcome to the Project Developers' Table

Posted: Tue Nov 09, 2010 9:28 pm
by mrduck
A couple samples with layouts

t4a.prg

Code: Select all

#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	'Presenze'		;
		Main					;
		On Init { || proviamo(oWindow) } 
	
        qW := Widget():New()	

        With Object o1 := Button():New()
            :Parent := qW
            :Caption    := '1111111111111'
        End With
                
        With Object o2 := Button():New()
            :Parent := qW
            :Caption    := '2222222222222'
        End With
                
        qW:CentralWidgetOf( oWindow )

    End Window

    Activate Window oWindow

Return

function proviamo( o )

    o1:oQTObject:setMaximumHeight( 600 )
    o1:oQTObject:setMaximumWidth( 600 )
    o1:oQTObject:setMinimumHeight( 200 )
    o1:oQTObject:setMinimumWidth( 200 )

    o2:oQTObject:setMaximumHeight( 600 )
    o2:oQTObject:setMaximumWidth( 600 )
    o2:oQTObject:setMinimumHeight( 200 )
    o2:oQTObject:setMinimumWidth( 200 )

    qL := QBoxLayout()
    qL:setContentsMargins(25,25,25,25)
    qL:setSizeConstraint( 5 )
    qL:setSpacing( 30 )
    qL:addWidget( o1:oQTObject )
    qL:addWidget( o2:oQTObject )

    qW:oQTObject:setLayout( qL )

return .T.

t4b.prg

Code: Select all

#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	'Presenze'		;
		Main					;
		On Init { || proviamo(oWindow) } 
	
        qW := Widget():New()	

        With Object o1 := Label():New()
            :Parent := qW
            :Value    := '1111111111111'
        End With
                
        With Object o2 := textbox():New()
            :Parent := qW
            :Value    := '2222222222222'
        End With
                
        qW:CentralWidgetOf( oWindow )

    End Window

    Activate Window oWindow

Return

function proviamo( o )

    o2:oQTObject:setMaximumWidth( 600 )
    o2:oQTObject:setMinimumWidth( 200 )

    qL := QGridLayout()
    qL:setContentsMargins(25,25,25,25)
    qL:setSizeConstraint( 5 )
    qL:setSpacing( 30 )
    qL:addWidget( o1:oQTObject, 1, 1 )
    qL:addWidget( o2:oQTObject, 1, 2 )
    qW:oQTObject:setLayout( qL )

return .T.


Re: Welcome to the Project Developers' Table

Posted: Wed Nov 10, 2010 5:27 am
by Rathinagiri
Francesco, I got this error, reported while compiling the above samples.

Date:11/10/10 Time: 10:56:48
Error BASE/1004 No exported method: CENTRALWIDGET

Called from CENTRALWIDGET( 0 )
Called from WIDGET:CENTRALWIDGETOF( 41 )
Called from MAIN( 30 )