line (row) spacing in say/get system using text coordinates

line (row) spacing in say/get system using text coordinates

Postby ipunis » Thu May 27, 2010 10:08 pm

Hello all,

i am new to fivewin/xharbour but programming in clipper for mopre than 20 years and now, for last few days, I am learning how to enter
in windows programming world.

As a beginner i have a lot of questions but try to find answers in documentation and samples. But for this one I cant find any answer.

Is there a way to set line (row) spacing in say/get system when coordinates is given in text mode.

Example:

@ 1,0 say "Row one"
@ 2,0 say "Row two"

Which is line spacing between row 1 and row 2, and/if is it possible to change that line spacing for selected window or dialog.

Thank you in advance,

Ivo
ipunis
 
Posts: 2
Joined: Thu May 27, 2010 9:51 pm

Re: line (row) spacing in say/get system using text coordinates

Postby ukoenig » Thu May 27, 2010 10:50 pm

Hello Ipunis :

Some small changes needed of :
// @ 1,0 say "Row one"
// @ 2,0 say "Row two"
...
...
Local oSay1, oSay2

// Optional using Vars :
Local cVar1 := "Row one"
Local cVar2 := "Row two"

@ 1,0 say oSay1 PROMPT "Row one"
@ 2,0 say oSay2 PROMPT "Row two"
or using Vars :
@ 1,0 say oSay1 VAR cVar1
@ 2,0 say oSay2 VAR cVar2

// Pixel optional
// -----------------
@ 15,10 say oSay1 PROMPT "Row one" PIXEL // use Pixel optional
@ 30,10 say oSay2 PROMPT "Row two" PIXEL

// a Button to change the given SAY-Positions

@ 140, 120 BTNBMP oBtn1 OF oDlg 2007 ;
SIZE 70 , 40 PROMPT "Move" ;
FONT oGetFont ;
LEFT ;
NOBORDER ;
FILENAME "Move.bmp" ;
ACTION ( oSay1:nTop := 3.5, oSay1:nLeft := 10.5, oSay1:Refresh(), ;
oSay2:nTop := 4.5, oSay2:nLeft := 10.5, oSay2:Refresh()
) // Set to new Position
oBtn1:lTransparent := .T.
oBtn1:cTooltip := " Move "
oBtn1:lBorder := .F.

or change the Position on Dialog-Init

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oSay1:nTop := 3.5, oSay1:nLeft := 10.5, oSay1:Refresh(), ;
oSay2:nTop := 4.5, oSay2:nLeft := 10.5, oSay2:Refresh()
)

define different Spaces, the way You want to do it from a Start-position
with a defined Font :

Image

Code: Select all  Expand view

#include "FiveWin.ch"

FUNCTION Main()
LOCAL oDlg, hDC
// here I am able to change line space for SAY section that follow
// 12 means that 12 PIXELS will be row spacing and I am going to multiply fun_lspac
// with row number for every single row I want to use with SAY/GET system
LOCAL  oSayFont := TFont():New("Arial", ,-12,.F.,.T. , , , ,.T. )

// - 11 because the Font-height is defined in POINT
LOCAL nstart1 := 0.1, nspace1 := oSayFont:nHeight - 11

// Pixel and Font-Height ( POINT ) are not the same,
You must find out the Space You need.
LOCAL nstart2 := 100, nspace2 := oSayFont:nHeight + 5  

SET _3DLOOK ON

DEFINE DIALOG oDlg FROM 10, 10 TO 50, 50 TRANSPARENT ;
TITLE "Dialog" STYLE nOr( WS_VISIBLE, WS_OVERLAPPEDWINDOW, WS_VSCROLL, WS_HSCROLL )

@  nstart1 + 1*nspace1, 2 SAY "Row one"
@  nstart1 + 2*nspace1, 2 SAY "Row two"
@  nstart1 + 3*nspace1, 2 SAY "Row three"
@  nstart1 + 4*nspace1, 2 SAY "Row four"
@  nstart1 + 5*nspace1, 2 SAY "Row five"


@  nstart2 + 1*nspace2, 10 SAY "USING PIXEL" PIXEL
@  nstart2 + 2*nspace2, 10 SAY "Program ID" PIXEL
@  nstart2 + 3*nspace2, 10 SAY "Program name" PIXEL
@  nstart2 + 4*nspace2, 10 SAY "Licence owner" PIXEL
@  nstart2 + 5*nspace2, 10 SAY "Current year" PIXEL
@  nstart2 + 6*nspace2, 10 SAY "Epoch (SET EPOCH)" PIXEL
@  nstart2 + 7*nspace2, 10 SAY "Lokal hard drive" PIXEL
@  nstart2 + 8*nspace2, 10 SAY "Network/database drive" PIXEL
 
 @ 15, 10 BUTTON "&End" ACTION oDlg:End()

ACTIVATE DIALOG oDlg CENTERED ;
ON PAINT D_GRADIENT( hDC, oDlg )

RETURN NIL

// ----- GRADIENT Dialog --------------------------

FUNCTION D_GRADIENT( hDC, oDlg )
LOCAL aColors :=   { { 0.1, 15778421, 16512957 },;
                                 { 0.1, 16512957, 15778421 } }  

GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors, .T. )

RETURN NIL
 


Best Regards
Uwe :lol:
Last edited by ukoenig on Fri May 28, 2010 1:06 pm, edited 6 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: line (row) spacing in say/get system using text coordinates

Postby ipunis » Fri May 28, 2010 8:36 am

Thanks Uwe,

I try first two solution (using text coordinates) but space between two lines remine same.
What I am talking about is free space between lines. Of course, if I do the same using PIXEL coordinates
then I am able to get controll over everything but I am courious if there is a way to change default
line spacing between rows when using text coordinates because using them it's simplfy my life :)

There is ad hoc solution I,ve made:

Code: Select all  Expand view

LOCAL fun_lspac:= 12   // here I am able to change line space for SAY section that follow
                       // 12 means that 12 PIXELS will be row spacing and I am going to multiply fun_lspac
                       // with row number for every single row I want to use with SAY/GET system

 @  01*fun_lspac, 10 SAY "Program ID                  " PIXEL
 @  02*fun_lspac, 10 SAY "Program name                " PIXEL
 @  03*fun_lspac, 10 SAY "Licence owner               " PIXEL
 @  04*fun_lspac, 10 SAY "Current year                " PIXEL
 @  05*fun_lspac, 10 SAY "Epoch (SET EPOCH)           " PIXEL
 @  06*fun_lspac, 10 SAY "Lokal hard drive            " PIXEL
 @  07*fun_lspac, 10 SAY "Network/database drive      " PIXEL

 


Maybe now is more clear what was my question :)
ipunis
 
Posts: 2
Joined: Thu May 27, 2010 9:51 pm

Re: line (row) spacing in say/get system using text coordinates

Postby Antonio Linares » Fri May 28, 2010 9:38 am

Hello Ivo,

Welcome to the forums :-)

If you review the source code of Class TSay (FWH\source\classes\say.prg) you will see that we use some constants to set the "simulated" text spacing on Windows:
Code: Select all  Expand view

      ::nTop  = nRow * SAY_CHARPIX_H + 2
      ::nLeft = nCol * SAY_CHARPIX_W
 

SAY_CHARPIX_H and SAY_CHARPIX_W are defined in FWH\include\constant.ch. So if you modify constant.ch and recompile say.prg and link it to your app as another OBJ then you can modify the spacing the way you may need it :-)

The same technique applies for other FWH controls :-)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 137 guests