wxGrid scrollbar

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Kocsonya
In need of some credit
In need of some credit
Posts: 9
Joined: Fri May 18, 2018 6:45 am

wxGrid scrollbar

Postby Kocsonya » Fri Jul 13, 2018 7:52 am

I came across a very interesting phenomenon:
I have a wxPanel.
In there is a vertical wxStaticBoxSizer.
The top half is not interesting, it has a bunch of checkboxes. The bottom half is a wxGrid.

When the grid has enough rows to be in need of a scrollbar, the scrollbar's *place* pops up (a slightly darker rectangle than the background) *and* I can scroll the grid with it, but it is not visible. The arrows and slider thingy are simply not visible, even though they work just fine.
It's most strange. I wonder if anyone has seen this strange behaviour and if yes, what might be the cause? Most likely me, but I can't figure out.
Code fragment that generates the whole thing is here, 'this' is an object derived from wxPanel:

Code: Select all

   sv = new wxStaticBoxSizer( wxVERTICAL, this, "Device log" );
   SetSizer( sv );
   
    ... create the top half, a panel named 'topwin', then ...
   
   logwin = new wxGrid( parent, myID_LOG );
   logwin->CreateGrid( NVM_LOGS, 3 );
   logwin->SetColLabelAlignment( wxLEFT, wxCENTRE );
   logwin->SetColLabelValue( 0, "Date" );
   logwin->SetColLabelValue( 1, "Time" );
   logwin->SetColLabelValue( 2, "Event" );
   logwin->EnableGridLines( true );
   logwin->HideRowLabels();
   sv->Add( topwin, 1, wxEXPAND );
   sv->Add( logwin, 1, wxEXPAND );


A related question: is it possible to tell wxGrid that one of its columns should be stretchable horizontally? Basically, I have 3 columns. What I'd like to happen when the user resizes the window horizontally is that the first two columns remain the same width all the time but the third one becomes wider or narrower as needed. Thus, the grid would always occupy all the available width rather than being only as wide as the content demands and having empty space between the right edge of the grid and the right edge of the window. Is it possible to do with wxGrid?

Thanks,

Zoltan

User avatar
doublemax
Moderator
Moderator
Posts: 12604
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGrid scrollbar

Postby doublemax » Fri Jul 13, 2018 8:51 am

Platform, wxWidgets version?

Can you reproduce the issue by modifying the "grid" sample?
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2633
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGrid scrollbar

Postby ONEEYEMAN » Fri Jul 13, 2018 3:03 pm

Hi,
Also, which toolkit is being used (if relevant)?

Thank you.

Kocsonya
In need of some credit
In need of some credit
Posts: 9
Joined: Fri May 18, 2018 6:45 am

Re: wxGrid scrollbar

Postby Kocsonya » Sun Jul 15, 2018 11:53 pm

The platform is Linux, the wxWidgets version is 3.0.4.
I doubt that I can reproduce it with the grid sample. It was working fine when the Grid was part of the application's main panel. Then I decided to split the panel in two with a horizontal sizer and one side became a panel with its own sizer and that's where the grid went. After that change the grid sh9ows this most peculiar behaviour.

The strange thing is that the scrollbar is there, it's operational - it is just now painted. I will try to build a stand-alone minimal program with everything else removed, just the grid and the panels and sizers there to see whether that would replicate the problem and if yes, I'll attach it.

Thanks,

Kocsonya
In need of some credit
In need of some credit
Posts: 9
Joined: Fri May 18, 2018 6:45 am

Re: wxGrid scrollbar

Postby Kocsonya » Mon Jul 16, 2018 1:07 am

Here's a stand-alone code that demonstrates the problem. It's about 250 lines, but it's mostly comments and empty lines.
There is a very high chance that the actual problem is some enormous stupidity in the code itself, feel free to hurl the relevant adjectives in my direction (but with some educational content, please)...
Attachments
grid_scrollbar.cpp
(5.17 KiB) Downloaded 7 times

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2633
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGrid scrollbar

Postby ONEEYEMAN » Mon Jul 16, 2018 1:19 am

Hi,
Is it compiled against GTK+2 or GTK+3?
Did you build the library or installed it from the repository?

Thank you.

Kocsonya
In need of some credit
In need of some credit
Posts: 9
Joined: Fri May 18, 2018 6:45 am

Re: wxGrid scrollbar

Postby Kocsonya » Mon Jul 16, 2018 2:28 am

Configure selected GTK+2, although both GTK+2 and GTK+3 are installed on the system.

The system is 32-bit, 3.4.11 SMP kernel with PAE.

I built wxWidgets from the source, ./configure && make && make install. Config says the following:

Configured wxWidgets 3.0.4 for `i686-pc-linux-gnu'

Which GUI toolkit should wxWidgets use? GTK+ 2 with support for GTK+ printing libnotify
Should wxWidgets be compiled into single library? no
Should wxWidgets be linked as a shared library? yes
Should wxWidgets support Unicode? yes (using wchar_t)
What level of wxWidgets compatibility should be enabled?
wxWidgets 2.6 no
wxWidgets 2.8 yes
Which libraries should wxWidgets use?
STL no
jpeg sys
png sys
regex builtin
tiff sys
zlib sys
expat builtin
libmspack no
sdl no


wx-config --cxxflags:
-I/usr/local/lib/wx/include/gtk2-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread

wx-config --libs:
-L/usr/local/lib -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0


Return to “C++ Development”

Who is online

Users browsing this forum: raananb and 25 guests