FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trouble with PIXEL clause of SAY command
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Trouble with PIXEL clause of SAY command
Posted: Tue Jul 16, 2013 04:57 PM
I am having trouble with the PIXEL clause of the SAY command.

This:

@ 140,120 say "Title" of oDlg pixel

Actually displays at 290, 242 (measured with an on-screen pixel ruler).

I can create correction factors and get it to display properly.

140/292 = .48
120/242 = .50

So I can do:

@ (140 * .48), (120 * .50) say "Title" of oDlg pixel

And it will be displayed properly. But why is it not displaying at the correct location without conversion? Am I doing something wrong or is it a bug in the SAY class?

I am using FWH 13.04 and BCC 5.82.

Antonio, Nages, anyone?

Regards,
James


Code (fw): Select all Collapse
// Sample program showing problem with PIXEL clause of SAY command

#include "fivewin.ch"

Function main()

   Local oDlg, oFont, oSay1, oSay2

   define font oFont name "Arial" size 0,-25

   DEFINE DIALOG oDlg size 600, 400

   // Actually displayed at 290, 242
   @ 140, 120 SAY oSay1 PROMPT "Title" ;
      font oFont OF oDlg PIXEL

   @ (140  * .48 ) , 120 * .5 say oSay2 ;
     PROMPT "Title w/ conversion" ;
     font oFont of oDlg PIXEL

   ACTIVATE DIALOG oDlg

   release font oFont

return nil
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Trouble with PIXEL clause of SAY command
Posted: Wed Jul 17, 2013 12:35 AM

OK, I solved the mystery. Dialogs have different units than windows, panels, etc. The controls are placed properly on windows (I didn't check panels yet). So, it does seem to be a bug--controls are not placed properly on dialogs when using the PIXEL clause. I haven't looked into where that would have to be fixed but it seems that controls need to be aware that their parent is a dialog and adjust accordingly. I assume that controls are using dialog units instead of pixels.

I knew it was going to be embarrassing when I discovered the answer.

Sometimes you just have to walk away from the computer and let your subconscious mind work.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Trouble with PIXEL clause of SAY command
Posted: Wed Jul 17, 2013 05:14 AM

Hello James,
If I remember well it was you who suggested to me the value 2.05.
It is my Euler number for dialogs. :)
I always use 999/2.05
@ (140 /2.05 ), (120 /2.05 ) say "Title" of oDlg pixel

This gives me good results.
Best regards,
Otto

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Trouble with PIXEL clause of SAY command
Posted: Wed Jul 17, 2013 01:38 PM

Otto,

Yes, I rarely hand code controls onto dialogs. I was working with Metro design ideas when this came up and I wasn't even thinking that it was on a dialog.

Nevertheless, it does seem that the conversion should be automatic. Mainly so feeble minded people like me don't have to remember ;-).

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Trouble with PIXEL clause of SAY command
Posted: Wed Jul 17, 2013 04:03 PM

James,

When the PIXEL clause was implemented in FWH we were not aware that on dialogs, controls use dialog units instead of pixels :-)

By the time that we noticed it (and really understood it), there were already many FWH code around, so we decided to keep it as it was :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Trouble with PIXEL clause of SAY command
Posted: Wed Jul 17, 2013 05:23 PM

Antonio,

Yes, I would agree that you can't break existing code.

The only solution I can see is to create a global setting to really use pixels instead of dialog units. But, I doubt there is much demand for this so I would place a very low priority on it.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion