XBrowse, how to turn on lines?

Re: XBrowse, how to turn on lines?

Postby nageswaragunupudi » Thu Apr 28, 2016 12:09 am

I have no problems here.

By default XBrowse does not display any lines. We need to use nColDividerStyle and nRowDividerStyle to turn on lines.

I have no problem with colors of lines either.
Regards

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

Re: XBrowse, how to turn on lines?

Postby nageswaragunupudi » Thu Apr 28, 2016 12:17 am

This is my test
Code: Select all  Expand view
func dbtest()

   local oBrw, oWnd

   USE CUSTOMER

   DEFINE WINDOW oWnd

   oBrw  := TXBrowse():New( oWnd )
   oBrw:SetRDD( .t. )

   WITH OBJECT oBrw

      :nColDividerStyle := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY

      :CreateFromCode()
   END
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED

return nil
 

I see vertical and horizontal lines in light gray

Screen Shot:
Image

Note:
You said you are able to see black lines ( LINESTYLE_BLACK ) but not other colors.

Let us keep in mind that by default XBrowse sets its background color ( ::nClrPane ) as well as cell background color ( bClrStd ) to GetSysColor( COLOR_WINDOW )

If by chance your system color for COLOR_WINDOW is set to Dark Gray or Light Gray then you will not be able to see lines with LINESTYLE_DARKGRAY or LINSTYLE_LIGHTGRAY. Please check your system colors.
Regards

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

Re: XBrowse, how to turn on lines?

Postby James Bott » Thu Apr 28, 2016 1:56 am

Rao,

The code I am running is exactly what I posted. The window background is white.

The only way I can get lines is to use the LINES clause in the browse definition.

If I try to turn on lines by setting the colors using:

:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY

There are still no lines.

I am running Windows 10. What version of Windows are you using?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: XBrowse, how to turn on lines?

Postby nageswaragunupudi » Thu Apr 28, 2016 3:15 am

I am running Windows 10.

1) Are you able to see lines with LINESTYLE_DARKGRAY ?

2) Can you please test my exact program and post the screen-shot?

3) Also please check the result of GetSysColor( COLOR_WINDOW ) and let us know the result.
Regards

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

Re: XBrowse, how to turn on lines?

Postby James Bott » Thu Apr 28, 2016 4:03 am

Rao et. al.,

I found the problem.

This doesn't show lines:

Code: Select all  Expand view
  oBrw:CreateFromCode()
   oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
   oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY
 


This does show lines:

Code: Select all  Expand view
  oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
   oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY
   oBrw:CreateFromCode()


Obviously, the oBrw:CreateFromCode() MUST come after the line color settings. I did not know this.

Since the code I posted didn't work for me but others said it worked, the logical conclusion is that they didn't test my exact code. And it explains why I was so confused. Logic never fails, although sometimes it is very elusive.

I am making a note in my FWH note file about this issue so it won't happen again.

Thank you everyone for your help.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: XBrowse, how to turn on lines?

Postby nageswaragunupudi » Thu Apr 28, 2016 4:07 am

I did not observe it either. Yes others and me included did not test your exact code nor examined it closely or one of us would have found the mistake.

Yes, very important point to note is that oBrw:CreateFromCode() should be the last statement after specifying all settings.
Regards

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

Re: XBrowse, how to turn on lines?

Postby James Bott » Thu Apr 28, 2016 4:23 am

very important point to note is that oBrw:CreateFromCode() should be the last statement after specifying all settings.


Thanks. Obviously, I didn't know that. It is now in my notes.

This is one reason that polymorphism (like naming) is important and useful in OOP. If the syntax for the browse was:

Code: Select all  Expand view
DEFINE XBROWSE oBrw
...
ACTIVATE BROWSE oBrw


Then there would be less chance of confusion, since all the other OOP objects use that syntax.

I'm not complaining about xbrowse as it is a terrific piece of code. I just wanted to point out one of the features of OOP for those that don't know.

Thanks Rao.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: XBrowse, how to turn on lines?

Postby James Bott » Thu Apr 28, 2016 4:33 am

Ok, now for some more confusion. Some settings are OK after the oBrw:CreateFromCode() call. These ones seem to work:

Code: Select all  Expand view
     oBrw:CreateFromCode()
     
      oBrw:setFont( oFont )
      oBrw:nRowHeight := 25
      oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW


This is why I didn't think it mattered. Still it is good policy to put the oBrw:CreateFromCode() call last.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: XBrowse, how to turn on lines?

Postby nageswaragunupudi » Thu Apr 28, 2016 9:28 am

James Bott wrote:Ok, now for some more confusion. Some settings are OK after the oBrw:CreateFromCode() call. These ones seem to work:

Code: Select all  Expand view
     oBrw:CreateFromCode()
     
      oBrw:setFont( oFont )
      oBrw:nRowHeight := 25
      oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW


This is why I didn't think it mattered. Still it is good policy to put the oBrw:CreateFromCode() call last.

James

It makes some difference you might have not noticed, if the browse was created in a window.

CreateFromCode() calls method Adjust(). Adjust() method calculates column widths and row heights on the basis of the old font which are not suited to the font you assigned later.
Regards

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

Re: XBrowse, how to turn on lines?

Postby James Bott » Thu Apr 28, 2016 2:28 pm

Rao,

CreateFromCode() calls method Adjust(). Adjust() method calculates column widths and row heights on the basis of the old font which are not suited to the font you assigned later.


Thanks for pointing that out. I was wondering why that wasn't working and I had to set the column widths manually.

More notes for my file.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 33 guests