CtrlLib: Fixed issue with DisplayPopup

This commit is contained in:
Mirek Fidler 2026-01-15 10:01:12 +01:00
parent e109c6aac7
commit 0105cb1818
2 changed files with 56 additions and 40 deletions

View file

@ -24,7 +24,8 @@ DisplayPopup::DisplayPopup()
void DisplayPopup::PaintHook(Ctrl *tw, Draw& w, const Rect& clip)
{
if(ctrl && !IsNull(screen_rect) && (tw == ctrl->GetTopCtrl() || tw && tw != ctrl->GetOwner())) {
if(ctrl && tw && !IsNull(screen_rect) && ctrl->HasMouseDeep() &&
(tw == ctrl->GetTopCtrl() || tw == ctrl->GetTopCtrl()->GetOwner())) {
Rect r = screen_rect - tw->GetScreenRect().TopLeft();
DrawFrame(w, r, SBlack());
r.Deflate(1, 1);

View file

@ -2,45 +2,60 @@
using namespace Upp;
struct MyApp : TopWindow {
MenuBar menu;
ArrayCtrl list;
DropList dl;
TreeCtrl tree;
ColumnList clist;
MyApp() {
list.AddColumn("Test");
list.Add("Simple");
for(int i = 0; i < 10; i++)
list.Add("Long " + String('X', i * 100));
dl.Add("Simple");
for(int i = 0; i < 10; i++)
dl.Add("Long " + String('X', i * 100));
Vector<int> parent, parent2;
parent.Add(0);
tree.SetRoot(Image(), "The Tree");
Array<Option> option;
for(int i = 1; i < 10000; i++) {
parent.Add(tree.Add(parent[rand() % parent.GetCount()],
i & 1 ? CtrlImg::open() : Image(),
FormatIntRoman(i, true)));
if((rand() & 3) == 0)
tree.Open(parent.Top());
}
tree.Open(0);
tree.MultiSelect().ScrollIntoX();
clist.Columns(3);
clist.MultiSelect();
for(int i = 0; i < 500; i++)
clist.Add(FormatIntRoman(i));
Sizeable().Zoomable();
Add(dl.TopPosZ(0).LeftPosZ(0, 100));
Add(list.VSizePosZ(Zx(20), 0).LeftPosZ(0, 100));
Add(tree.VSizePosZ(Zx(20), 0).LeftPosZ(100, 100));
Add(clist.VSizePosZ(Zx(20), 0).LeftPosZ(200, 100));
AddFrame(menu);
for(int i = 0; i < 6; i++)
menu.Sub(AsString(i), [=](Bar& menu) {
for(int i = 0; i < 15; i++)
menu.Add(AsString(i), [] { PromptOK("!"); });
});
}
};
GUI_APP_MAIN
{
ArrayCtrl list;
list.AddColumn("Test");
list.Add("Simple");
for(int i = 0; i < 10; i++)
list.Add("Long " + String('X', i * 100));
DropList dl;
dl.Add("Simple");
for(int i = 0; i < 10; i++)
dl.Add("Long " + String('X', i * 100));
TreeCtrl tree;
Vector<int> parent, parent2;
parent.Add(0);
tree.SetRoot(Image(), "The Tree");
Array<Option> option;
for(int i = 1; i < 10000; i++) {
parent.Add(tree.Add(parent[rand() % parent.GetCount()],
i & 1 ? CtrlImg::open() : Image(),
FormatIntRoman(i, true)));
if((rand() & 3) == 0)
tree.Open(parent.Top());
}
tree.Open(0);
tree.MultiSelect().ScrollIntoX();
ColumnList clist;
clist.Columns(3);
clist.MultiSelect();
for(int i = 0; i < 500; i++)
clist.Add(FormatIntRoman(i));
TopWindow win;
win.Sizeable().Zoomable();
win.Add(dl.TopPosZ(0).LeftPosZ(0, 100));
win.Add(list.VSizePosZ(Zx(20), 0).LeftPosZ(0, 100));
win.Add(tree.VSizePosZ(Zx(20), 0).LeftPosZ(100, 100));
win.Add(clist.VSizePosZ(Zx(20), 0).LeftPosZ(200, 100));
win.Run();
MyApp().Run();
}