FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowser: Is it possible to change alignment on the fly?
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Sat Dec 15, 2007 12:35 AM

nDataStrAlign := AL_RIGHT

Is it possible to change alignment on the fly?
Thanks in advance
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Sat Dec 15, 2007 10:43 AM

Otto,

Have you tried to change it and refresh the browse ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Sat Dec 15, 2007 09:44 PM

Thank you. Yes I tried with refresh().
Here is my code:

func f_DataStrAlign(r,c,f,o)

      oBrw:nRowDividerStyle := 0    // I put this to proof that refresh is working

      oBrw:aCols[ o:nPos ]:nDataStrAlign :=   AL_RIGHT

      oBrw:refresh()

      return nil

The text does not move.
Regards,
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 10:30 AM

Otto,

Try it this way:

oCol = oBrw:aCols[ o:nPos ]
oCol:nDataStrAlign := AL_RIGHT
oCol:nDataStyle := oCol:DefStyle( oCol:nDataStrAlign, ( oCol:oBrw:nDataLines == 1 ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 01:13 PM
Alignment changes but Al_right is not displayed well.
See screen:
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 01:30 PM

Try to RTrim() the column data.

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 01:59 PM

Working perfectly

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 02:08 PM
METHOD	DataAlign( nAlign ) CLASS TXBrwColumn

	if ! ( ::nDataStrAlign == nAlign )  // tolerate nil param
	   ::nDataStrAlign := AL_RIGHT
      ::nDataStyle := ::DefStyle( ::nDataStrAlign, ( ::oBrw:nDataLines == 1 ) )
   endif

RETURN ::nDataStrAlign
Regards



G. N. Rao.

Hyderabad, India
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 02:40 PM
Thank you Enrico.
I changed it in METHOD PaintData:
if ::bStrData != nil
cData := RTRIM( Eval( ::bStrData, Self ))
else
cData := ""
endif
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 02:42 PM

To nageswaragunupudi:
If I insert the method DataAlign I get all centered.
Regaqrds,
Otto

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 02:51 PM

Mr Otto

Obviously the values should be rtimmed for right justification. My proposed method is only for changing justification on the fly.

If you change the paint method you may like to cover the cases of left, center and riight justifcations and all other possibilities. For non left justified painting probably alltrim(,,,) may be better, We should also keep in mind multiple line painting. Paint is a very generic method. Should we change this paint method or specify bStrData appropriately?

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 09:01 PM

It is most common to right justify numbers and left justify text in tables. Numbers need to be right justified to make the decimals aline. I can't think of a good reason to right justify text.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowser: Is it possible to change alignment on the fly?
Posted: Mon Dec 17, 2007 09:47 PM

Hello James,

to learn to use xBrowser I created a little tool xBTool to build a xBrowser visually.
There I want to click on the header and select if the column should be right aligned or left.

Doing this I saw that text fields do not align accurately. Therefore I pointed this problem out.

Regards,
Otto

Continue the discussion