FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Resource problem
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Resource problem
Posted: Fri Jan 15, 2010 07:32 PM
Hi all,

is it possible to get the position of a control in a dialog, that is defined in a compiled resource file on runtime ?

I need to know the coordinates where the control is placed inside the dialog.

Code (fw): Select all Collapse
DEFINE DIALOG oDlg ....
REDEFINE BROWSE oBrw OF oDlg
...
...
aRect :=  GetCoordinates (oBrw)
kind regards

Stefan
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Resource problem
Posted: Fri Jan 15, 2010 07:47 PM

Have you tried:

oControl:nTop
oControl:nRight

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Resource problem
Posted: Sat Jan 16, 2010 04:26 PM
James,
James Bott wrote:
oControl:nTop
oControl:nRight


thanks, if the object is already created, you can do it like this.

But I must apologize, the sample was wrong and my question was not very clear.

I need to know the coordinates of a control inside the definition of class itself. I try another sample

Code (fw): Select all Collapse
CLASS xy

DATA nTop, nLeft,...

METHOD Redefine (...)
METHOD Initialize()
...
...

ENDCLASS

// Method Initialize is automatically called after ::redefine ()
METHOD Initialize (hDlg)
...
::hWnd := GetDlgItem( hDlg, ::nId )  // Get the control handle
oRect := ???   //Here I must get the coordinates


I tried with GetClientRect (::hWnd), but it always returns 0 for nTop and nLeft and not the real position inside the dialog.

Stefan
kind regards

Stefan
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Resource problem
Posted: Sat Jan 16, 2010 06:40 PM

Stefan.

I'm sorry, I still don't understand what you are trying to do.

What is Class XY, a dialog, a control, a dialog with all it's controls, something else? Is it a subclass?

I think you are going to have to provide a small working sample.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Resource problem
Posted: Sat Jan 16, 2010 10:39 PM
Hello Steffan

GetClientRect This function retrieves the dimensions of the window client area, i mean, all inside area

to get position you can use GetCoors( hWnd )

Code (fw): Select all Collapse
::hWnd = GetDlgItem( hDlg, ::nId ) 
aPosRect = GetCoors( ::hWnd )
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Resource problem
Posted: Mon Jan 18, 2010 08:55 AM

James,

the class xy is just a template or sample of a control class. It defines a new control. Inside its method Initialize() I want to get its position inside a dialog to.

Daniel,

That´s it, GetCoors () is working fine. Thanks.

kind regards

Stefan

Continue the discussion