FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos controls on dialog init/not init
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
controls on dialog init/not init
Posted: Wed Jul 01, 2015 08:28 AM
hello,
I have those 2 samples:
Code (fw): Select all Collapse
#include "FiveWin.ch"

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

function Main()

   local oDlg, cFirst := "Hello", cLast := "World"

   DEFINE DIALOG oDlg SIZE 500, 250
   
   @ 1, 1 GET cFirst OF oDlg SIZE 80, 10
   
   @ 2, 1 GET cLast OF oDlg SIZE 80, 10

   @ 5, 11 BUTTON "Ok" ACTION MsgInfo( cFirst + ", " + cLast )

   @ 5, 21 BUTTON "Cancel" ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil

that produce:
Code (fw): Select all Collapse
#include "FiveWin.ch"

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

function Main()

   local oDlg

   DEFINE DIALOG oDlg SIZE 500, 250
      ACTIVATE DIALOG oDlg CENTERED ON INIT init(oDlg)

return nil

PROC init(oDlg)

   local  cFirst := "Hello", cLast := "World"
   @ 1, 1 GET cFirst OF oDlg SIZE 80, 10
   
   @ 2, 1 GET cLast OF oDlg SIZE 80, 10

   @ 5, 11 BUTTON "Ok" ACTION MsgInfo( cFirst + ", " + cLast )

   @ 5, 21 BUTTON "Cancel" ACTION oDlg:End()

return


that produce:

I usually use the second code.
I tried for 5 minutes to find why, but I was not able to found it.

Regards,
Antonino
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: controls on dialog init/not init
Posted: Wed Jul 01, 2015 10:23 AM

Hi Antonino,

may be the difference is related to the font setup that in turns affects the dialog's coordinates system. It is easy to try: just change dialog font and you'll see how dialog changes it's size. Just try that in a Resource Editor like PellesC, it will be obvious.

Probably setting a font in the DEFINE DIALOG will solve the problem.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: controls on dialog init/not init
Posted: Wed Jul 01, 2015 12:54 PM
Antonino,

When a dialogbox is going to be created it uses "units" (including the created controls):

https://msdn.microsoft.com/en-us/library/windows/desktop/ms645475(v=vs.85).aspx

Once it is created (ON INIT) the controls use pixels.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: controls on dialog init/not init
Posted: Wed Jul 01, 2015 02:45 PM
Antonio Linares wrote:Antonino,

When a dialogbox is going to be created it uses "units" (including the created controls):

https://msdn.microsoft.com/en-us/library/windows/desktop/ms645475(v=vs.85).aspx

Once it is created (ON INIT) the controls use pixels.


It always looks as a bug...

The really strange thing is the style of TGet, in the first case they have the clientEdge, in the second case they look with square brackets...
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: controls on dialog init/not init
Posted: Wed Jul 01, 2015 08:02 PM

Antonino,

Try to increase the height of the GETs and surely they will look fine

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion