|
|
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Multiline popups in GridCtrl
Multiline popups in GridCtrl [message #23467] |
Wed, 21 October 2009 11:36 |
Zbych
Messages: 326 Registered: July 2009
|
Senior Member |
|
|
Hi,
Is it possible to show multi line pop-ups in GridCtrl?
When I insert multi line text (each line ended with '\n') into cell, pop-up shows everything in a single line. That behavior is inconsistent with ArrayCtrl which is able to show it correctly.
|
|
|
Re: Multiline popups in GridCtrl [message #23468 is a reply to message #23467] |
Wed, 21 October 2009 12:24 |
|
Zbych wrote on Wed, 21 October 2009 05:36 | Hi,
Is it possible to show multi line pop-ups in GridCtrl?
When I insert multi line text (each line ended with '\n') into cell, pop-up shows everything in a single line. That behavior is inconsistent with ArrayCtrl which is able to show it correctly.
|
Not at the moment. I remeber that I wanted popup to use particular display assigned with the cell so it was able to use the same fonts, colors and stuff but I came acrros some complications I gave up. But I'll try once again
|
|
|
|
Re: Multiline popups in GridCtrl [message #23600 is a reply to message #23598] |
Tue, 03 November 2009 20:45 |
|
zsolt wrote on Tue, 03 November 2009 09:16 | You can do it using your own Display class.
The trick is, that you have to overload GetStdSize and Paint virtual methods in your own Display class.
|
I haven't announced that, but GridCtrl now automatically wraps the text in popup and make it bigger if necessary.
|
|
|
|
Re: Multiline popups in GridCtrl [message #23614 is a reply to message #23613] |
Thu, 05 November 2009 00:41 |
|
Thanks for reporting this. I think I have finally fixed 2 and 3. But I don't understand what's wrong with point 1. The text is Y-centered - in this case on the middle of the cell there is a middle line from multiline text.
|
|
|
|
|
Re: Multiline popups in GridCtrl [message #23638 is a reply to message #23617] |
Mon, 09 November 2009 11:56 |
Zbych
Messages: 326 Registered: July 2009
|
Senior Member |
|
|
unodgs wrote on Thu, 05 November 2009 11:52 | I push this change up to the repository together with other changes.
|
Hi,
I've found a few other problems:
1. When I move mouse cursor from one cell to another, pop-up shows content of the previous cell:
2. column sum doesn't add last row:
3. Pop-up on cell with number (column #1) causes an assertion:
Test code:
struct App : public TopWindow
{
typedef App CLASSNAME;
Button ok;
GridCtrl grid;
void AddToGrid();
App(){
grid.HSizePosZ(10,10);
Sizeable();
Add(grid.SizePos().HSizePos(50,50).VSizePosZ(50,50));
grid.SummaryRow();
grid.AddColumn( "Name").DoSum("%d");
grid.AddColumn( "Surname").DoSum("%d");
grid.ColorRows();
ok.WhenPush = THISBACK(AddToGrid);
ok.SetLabel(t_("OK")).HCenterPosZ(76, -84).BottomPosZ(8, 32);
Add(ok);
}
};
void App::AddToGrid(){
grid.Clear();
for(int l=0; l<3; l++){
grid.Add(l, 1);
}
Beep(1000,100);
}
GUI_APP_MAIN
{
App app;
app.Run();
}
-
Attachment: grid3.PNG
(Size: 2.23KB, Downloaded 1184 times)
-
Attachment: grid4.PNG
(Size: 4.59KB, Downloaded 862 times)
-
Attachment: grid5.PNG
(Size: 3.12KB, Downloaded 1095 times)
-
Attachment: grid6.PNG
(Size: 2.26KB, Downloaded 1189 times)
[Updated on: Mon, 09 November 2009 13:37] Report message to a moderator
|
|
|
|
|
Re: Multiline popups in GridCtrl [message #23776 is a reply to message #23754] |
Fri, 20 November 2009 15:59 |
Zbych
Messages: 326 Registered: July 2009
|
Senior Member |
|
|
Another problem. In my application I use WhenCursor callback to enable/disable ToolBar. Inside this callback I check if any row is selected by calling IsCursor. The problem is that IsCursor gives incorrect state of cursor at that time (probably WhenCursor callback is executed to early in GridCtrl::SetCursor0).
Steps:
1. click add
2. click on some row - tool bar should be enabled (but it is not)
3. click second time - now tool bar is enabled.
4. click clear - now grid is empty, but callback is not executed (in my opinion should be, because cursor is gone) and tool bar is not deactivated.
Test code:
struct App : public TopWindow
{
typedef App CLASSNAME;
Button ok;
Button clear;
ToolBar tool;
GridCtrl grid;
void AddToGrid();
void ClearGrid();
void MyToolBar(Bar& bar);
void ToolBarRefresh();
App();
};
App::App()
{
Sizeable();
grid.HSizePosZ(10,10);
tool.Set(THISBACK(MyToolBar));
AddFrame(tool);
Add(grid.SizePos().HSizePos(0,0).VSizePosZ(0,50));
grid.AddColumn( "Name").DoSum("%d");
grid.AddColumn( "Surname").DoSum("%d");
grid.WhenCursor = THISBACK(ToolBarRefresh);
ok.WhenPush = THISBACK(AddToGrid);
clear.WhenPush = THISBACK(ClearGrid);
ok.SetLabel(t_("Add")).HCenterPosZ(76, -84).BottomPosZ(8, 32);
clear.SetLabel(t_("Clear")).HCenterPosZ(76, 80).BottomPosZ(8, 32);
Add(ok);
Add(clear);
}
void App::AddToGrid(){
for(int l=0; l<5; l++){
grid.Add(l, Format("Row %d\nRow %d\nRow %d\n", l,l,l));
}
}
void App::ClearGrid()
{
grid.Clear();
}
void App::MyToolBar(Bar& bar)
{
bar.Add(grid.IsCursor(), "File", Image::Wait() , THISBACK(ClearGrid));
bar.Add(grid.IsCursor(), "File", Image::Wait() , THISBACK(ClearGrid));
}
void App::ToolBarRefresh()
{
tool.Set(THISBACK(MyToolBar));
Beep(1000,100);
}
GUI_APP_MAIN
{
App app;
app.Run();
}
|
|
|
Re: Multiline popups in GridCtrl [message #23816 is a reply to message #23776] |
Tue, 24 November 2009 13:29 |
|
Yes, you're rigth. WhenCursor is called very early in SetCursor method. It's mainly to have ability in callback to call CancelCursor() that prevents cursor from changing its position. On the other hand I agree that IsCursorValid and others methods should return correct values in the callback. I have fixed all your problems. The only thing that holds me with commiting the code is I found painting algorithm very slow if line ends with \n char.
|
|
|
|
|
Goto Forum:
Current Time: Mon May 06 04:15:20 CEST 2024
Total time taken to generate the page: 0.02655 seconds
|
|
|