Auto fits/sorts controls of dialog in different resolutions

Auto fits/sorts controls of dialog in different resolutions

Postby ShumingWang » Fri Jun 16, 2006 1:46 am

Dear All,
Our dialog resources in dll designed to 800*600 resolution , now we write a small function( called on dialog init) to auto fit/sort controls of dialog according different resolution as 1024*768,1280*1024, all the controls seems OK, but -1 ids (static text, groups) seems not exists in odialog:acontrols,how to detect these -1 ids ?


rsl0:=getsysmetrics(0)/800
rsl1:=getsysmetrics(1)/600
for i:=1 TO LEN(odlg:acontrols)
oCtrol = odlg:aControls[i]
aRect = GetCoors( oCtrol:hWnd )
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1, (aRect[4] - aRect[2])*rsl0, (aRect[3] - aRect[1])*rsl1, .t. )
next

Best regard!
Shuming Wang
ShumingWang
 
Posts: 461
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: Auto fits/sorts controls of dialog in different resoluti

Postby Enrico Maria Giordano » Fri Jun 16, 2006 7:18 pm

ShumingWang wrote:how to detect these -1 ids ?


You can't, as far as I know.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8600
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Auto fits/sorts controls of dialog in different resoluti

Postby Maurilio Viana » Mon Jun 19, 2006 4:07 pm

Wang, the best way to do it is create a ID to each control. I use any like it and I create an ID to each "say", then I do a "pseudo redefine" like this:

redefine say id 51 of oDlg
redefine say id 52 of oDlg
(...)

For while is hard to redefine each say but is only way I found. Or you can create a function and refer to say's IDs in an array. Any like this

MyRedefineSay({51,52,52,53}, oDlg)
...

function MyRedefineSay(aID, oDlg)
local n
FOR n := 1 to len(aID)
TSay():Redefine(aId[n] ......... )
NEXT
return

//-----------------------------------

Only a suggest :-)

Bast regards,
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby James Bott » Mon Jun 19, 2006 4:28 pm

Shuming,

I found the text below in my notes. You might give it a try.

James

-----------------------------------------
6/21/2004 9:00 PM

If you change the size of the dialog font in Workshop, then the dialog is automatically resized to accomodate the new font. This resizing occurs both in Workshop and in the application. Note that in Workshop the dialog is displayed larger than it will be in the application.

[Note: WS defaults to a MS Sans Serif, 8 point font when you define a new dialog.]

The automatic resizing happens inside the dialogBox() function called in TDialog:activate(). This seems to be inside the Win API. There is no built-in way to force the dialog to resize by changing the font after the dialog has been initialized.

You can change the font of a dialog via code if you do it before activating the dialog:

define dialog oDlg...
oDlg:setFont(oFont)
activate dialog oDlg

However, I find that the font is about 4 points smaller on the screen that it is if you define the font in Workshop. E.G. you would have to use a 16point font via setFont() in order to get the same sized font on the screen that you would get if you defined a 12point font in WS. I think this must be a bug somewhere.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests