Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl and SplitterFrame
GridCtrl and SplitterFrame [message #36108] |
Sat, 28 April 2012 04:47  |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hi,
When I add a SplitterFrame to a GridCtrl in a dialog, the GridCtrl still uses the entire original space for its scrollbar.
For example, I want to share the left hand side of my dialog between two GridCtrl objects so I add one to the layout in the layout designer and then I add the splitterFrame to that GridCtrl and add another GridCtrl to the SplitterFrame.
IMO the behaviour should be that the two GridCtrls share the space according to the SplitterFrame which they do but also their scrollbars should do the same too which they don't.
If you need me to I can upload an example but it is very quick and easy to recreate.
Cheers,
Nick
|
|
|
|
Re: GridCtrl and SplitterFrame [message #36402 is a reply to message #36348] |
Thu, 24 May 2012 02:02   |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hi Daniel,
The following code in a CtrlLib application recreates the problem.
SplitGrid.h
#ifndef _SplitGrid_SplitGrid_h
#define _SplitGrid_SplitGrid_h
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <SplitGrid/SplitGrid.lay>
#include <CtrlCore/lay.h>
#include <GridCtrl/GridCtrl.h>
class SplitGrid : public WithSplitGridLayout<TopWindow> {
public:
typedef SplitGrid CLASSNAME;
SplitGrid();
GridCtrl m_grid1,m_grid2;
SplitterFrame sf1,sf2;
};
#endif
main.cpp
#include "SplitGrid.h"
SplitGrid::SplitGrid()
{
CtrlLayout(*this, "Window title");
Sizeable().Zoomable();
label.AddFrame(sf1.Left(m_grid1,200));
m_grid1.AddFrame(sf2.Bottom(m_grid2,200));
m_grid1.Ready(false);
m_grid1.AddColumn("health",100);
m_grid1.AddColumn("wealth",100);
m_grid1.SetRowCount(20);
m_grid1.Ready(true);
m_grid2.Ready(false);
m_grid2.AddColumn("black",100);
m_grid2.AddColumn("white",100);
m_grid2.SetRowCount(20);
m_grid2.Ready(true);
}
GUI_APP_MAIN
{
SplitGrid().Run();
}
SplitGrid.lay
LAYOUT(SplitGridLayout, 532, 332)
ITEM(EditString, label, HSizePosZ(0, 0).VSizePosZ(0, 0))
END_LAYOUT
|
|
|
Re: GridCtrl and SplitterFrame [message #36411 is a reply to message #36402] |
Thu, 24 May 2012 14:46   |
|
Thanks for the test case. Now I see what you mean 
It happens like that because grid has 3 frames:
0 - view frame
1 - scrollbar x frame
2 - scrollbar y frame
So now if you call grid.AddFrame(..) you are adding control inside y frame...
To fix this simply change:
m_grid1.AddFrame(sf2.Bottom(m_grid2,200));
to
m_grid1.InsertFrame(0, sf2.Bottom(m_grid2,200));
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 11:19:07 CEST 2025
Total time taken to generate the page: 0.03520 seconds
|