xBrowser: Is it possible to change alignment on the fly?

xBrowser: Is it possible to change alignment on the fly?

Postby Otto » Sat Dec 15, 2007 12:35 am

nDataStrAlign := AL_RIGHT

Is it possible to change alignment on the fly?
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

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

Postby Otto » Sat Dec 15, 2007 9: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
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

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

Postby Otto » Mon Dec 17, 2007 1:13 pm

Alignment changes but Al_right is not displayed well.
See screen:
Image
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Mon Dec 17, 2007 1:30 pm

Try to RTrim() the column data.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby nageswaragunupudi » Mon Dec 17, 2007 1:59 pm

Working perfectly
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Mon Dec 17, 2007 2:08 pm

Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Mon Dec 17, 2007 2:40 pm

Thank you Enrico.
I changed it in METHOD PaintData:
if ::bStrData != nil
cData := RTRIM( Eval( ::bStrData, Self ))
else
cData := ""
endif
Image
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Mon Dec 17, 2007 2:42 pm

To nageswaragunupudi:
If I insert the method DataAlign I get all centered.
Regaqrds,
Otto
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Mon Dec 17, 2007 2: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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby James Bott » Mon Dec 17, 2007 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Otto » Mon Dec 17, 2007 9: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
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests