controls on dialog init/not init

controls on dialog init/not init

Postby AntoninoP » Wed Jul 01, 2015 8:28 am

hello,
I have those 2 samples:
Code: Select all  Expand view  RUN
#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:Image
Code: Select all  Expand view  RUN
#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:Image

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

Regards,
Antonino
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: controls on dialog init/not init

Postby Carlos Mora » 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"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: controls on dialog init/not init

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: controls on dialog init/not init

Postby AntoninoP » Wed Jul 01, 2015 2: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...
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: controls on dialog init/not init

Postby Antonio Linares » Wed Jul 01, 2015 8:02 pm

Antonino,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 29 guests