Page 1 of 1

Extra spacing in GET on Window!

Posted: Sat Mar 11, 2006 3:20 pm
by modicr
Hello!

Bellow are two pictures - results of following two samples:
Sample "Dialog":

Code: Select all

#include "FiveWin.ch"
static  fntErr, fntOK

function Main()
   LOCAL oUI, oGet
   LOCAL cErr := "F1- Arial "
   LOCAL cOK  := "F2 - Verdana "

   SET _3DLOOK OFF
   DEFINE FONT fntErr NAME "Arial" SIZE 0,32
   DEFINE FONT fntOK  NAME "Verdana" SIZE 0, 32

   DEFINE DIALOG oUI TITLE "Dialog: " + FWVERSION
   @ 1,    1 GET oGet VAR cErr OF oUI SIZE 120, 20 COLOR "W/G" PICTURE "@K"  NOBORDER FONT fntErr
   @ 3,    1 GET oGet VAR cOk OF oUI SIZE 120, 20 COLOR "W/G" PICTURE "@K"  NOBORDER FONT fntOK
   ACTIVATE DIALOG oUI
return nil  // Main
Sample "Window":

Code: Select all

#include "FiveWin.ch"
static  fntErr, fntOK

function Main()
   LOCAL oUI, oGet
   LOCAL cErr := "F1- Arial "
   LOCAL cOK  := "F2 - Verdana "

   SET _3DLOOK OFF
   DEFINE FONT fntErr NAME "Arial" SIZE 0,32
   DEFINE FONT fntOK  NAME "Verdana" SIZE 0, 32

   DEFINE WINDOW oUI TITLE "Window: " + FWVERSION
   @ 1,    1 GET oGet VAR cErr OF oUI SIZE 240, 40 COLOR "W/G" PICTURE "@K"  NOBORDER FONT fntErr
   @ 6,    1 GET oGet VAR cOk OF oUI SIZE 240, 40 COLOR "W/G" PICTURE "@K"  NOBORDER FONT fntOK
   ACTIVATE WINDOW oUI
return nil  // Main
Result of "Dialog":
Image
Result of "Window":
Image

As you can see, there is additional spacing in GET when
Arial font is used on window. What can be done to
remove this spacing???

Thanks, Roman

Re: Extra spacing in GET on Window!

Posted: Sun Mar 12, 2006 10:53 am
by fp
that's my solution, see oGet:bGotFocus - > TRIM(oGet:oGet:Buffer)

Code: Select all

oGet     := TGet():ReDefine(nId,bBlock,self,,xPicture,,,,,,cMessage,.F.,,,.F.,.F.,,,,)
oGet:bGotFocus  := {||oGet:SetSel(0,0),oGet:SetColor(RGB_RED,RGB_YELLOW),SetWindowText(oGet:hWnd,TRIM(oGet:oGet:Buffer),__KEYBOARD(CHR(VK_END)))}
oGet:bLostFocus := {||oGet:SetColor(RGB_BLACK,RGB_WHITE)}


Posted: Sun Mar 12, 2006 2:52 pm
by modicr
Hello!

Thanks for your reply - unfortunately this does not solve the problem!

Roman

Posted: Mon Mar 13, 2006 10:05 am
by modicr
BTW, here is how it looks in Delphi 7:

Image

Best regards, Roman

Posted: Mon Mar 13, 2006 10:20 am
by Antonio Linares
Roman,

Its a curious behavior, as such extra space is not writeable.

If you try to place the cursor there and type, you can't.

Lets see if we find where that left space comes from.

Thanks,

Posted: Tue Mar 14, 2006 10:12 am
by modicr
Hello!
Lets see if we find where that left space comes from.
:)

BTW, there is unnecessary margin at the right edge, too:
Image

Regards, Roman

Posted: Fri Mar 17, 2006 12:30 pm
by modicr
Hello!

Found the solution :D !

By googling I encountered more the 10 years
old MS KB article:
http://support.microsoft.com/default.as ... -us;138419

Fortunately you have already written (October 2004 build)
TGet method SetMargins(nL, nR)
* Enhancement: Class TGet new Methods SetMargins() and GetMargins(). They allow the GETs to show the same margins on different Windows versions and 16 and 32 bits. Many thans to Walter Negro and Luis Krause.
which by default sets margins to 1,1. So I just called
o:SetMargins(0,0) after creating GETs.

Regards, Roman