[GH-ISSUE #273] Mouse events are ignored in LabelBox #85

Closed
opened 2026-05-05 03:38:47 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @ortman on GitHub (Jun 1, 2025).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/273

LabelBox is a container, if you add other controls to it, they will not respond to mouse events.

Example:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	TopWindow window;
	window.Sizeable().Zoomable().SetRect(0, 0, 100, 100);
	
	Button b;
	b.SetLabel("Button");
	
	b.WhenPush  = [=] {
		PromptOK("Click");
	};
		
	LabelBox labelBox;
	labelBox.SetLabel("LableBox");
	labelBox.Add(b.HSizePosZ(7, 7).VSizePosZ(12, 7));
	
	window.Add(labelBox.HSizePosZ(5, 5).VSizePosZ(5, 5));
	
	window.Run();
}

The button is not clicked by the mouse, because LabelBox is inherited from StaticText, in the constructor of which there is "IgnoreMouse();"

Solution:
Add to the constructor of the LabelBox class
NoIgnoreMouse();

Do you support my proposal?

Originally created by @ortman on GitHub (Jun 1, 2025). Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/273 LabelBox is a container, if you add other controls to it, they will not respond to mouse events. Example: ``` #include <CtrlLib/CtrlLib.h> using namespace Upp; GUI_APP_MAIN { TopWindow window; window.Sizeable().Zoomable().SetRect(0, 0, 100, 100); Button b; b.SetLabel("Button"); b.WhenPush = [=] { PromptOK("Click"); }; LabelBox labelBox; labelBox.SetLabel("LableBox"); labelBox.Add(b.HSizePosZ(7, 7).VSizePosZ(12, 7)); window.Add(labelBox.HSizePosZ(5, 5).VSizePosZ(5, 5)); window.Run(); } ``` The button is not clicked by the mouse, because LabelBox is inherited from StaticText, in the constructor of which there is "IgnoreMouse();" Solution: Add to the constructor of the LabelBox class ` NoIgnoreMouse(); ` Do you support my proposal?
Author
Owner

@mirek-fidler commented on GitHub (Jun 1, 2025):

LabelBox is not a container, just decoration.

(we are not going that direction. We want layout files, which is in direct
opposition to LabelBox being a container).

Mirek

On Sun, Jun 1, 2025 at 11:19 AM Sergey Ortman @.***>
wrote:

ortman created an issue (ultimatepp/ultimatepp#273)
https://github.com/ultimatepp/ultimatepp/issues/273

LabelBox is a container, if you add other controls to it, they will not
respond to mouse events.

Example:

`
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
TopWindow window;
window.Sizeable().Zoomable().SetRect(0, 0, 100, 100);

Button b;
b.SetLabel("Button");

b.WhenPush = [=] {
PromptOK("Click");
};

LabelBox labelBox;
labelBox.SetLabel("LableBox");
labelBox.Add(b.HSizePosZ(7, 7).VSizePosZ(12, 7));

window.Add(labelBox.HSizePosZ(5, 5).VSizePosZ(5, 5));

window.Run();

}
`

The button is not clicked by the mouse, because LabelBox is inherited from
StaticText, in the constructor of which there is "IgnoreMouse();"

Solution:
Add to the constructor of the LabelBox class
NoIgnoreMouse();


Reply to this email directly, view it on GitHub
https://github.com/ultimatepp/ultimatepp/issues/273, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AARH237I4IERFBSYZAS2AQD3BLATPAVCNFSM6AAAAAB6K4BYB2VHI2DSMVQWIX3LMV43ASLTON2WKOZTGEYDMOJUGEYDAOA
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

<!-- gh-comment-id:2926915503 --> @mirek-fidler commented on GitHub (Jun 1, 2025): LabelBox is not a container, just decoration. (we are not going that direction. We want layout files, which is in direct opposition to LabelBox being a container). Mirek On Sun, Jun 1, 2025 at 11:19 AM Sergey Ortman ***@***.***> wrote: > *ortman* created an issue (ultimatepp/ultimatepp#273) > <https://github.com/ultimatepp/ultimatepp/issues/273> > > LabelBox is a container, if you add other controls to it, they will not > respond to mouse events. > > Example: > > ` > #include <CtrlLib/CtrlLib.h> > > using namespace Upp; > > GUI_APP_MAIN > { > TopWindow window; > window.Sizeable().Zoomable().SetRect(0, 0, 100, 100); > > Button b; > b.SetLabel("Button"); > > b.WhenPush = [=] { > PromptOK("Click"); > }; > > LabelBox labelBox; > labelBox.SetLabel("LableBox"); > labelBox.Add(b.HSizePosZ(7, 7).VSizePosZ(12, 7)); > > window.Add(labelBox.HSizePosZ(5, 5).VSizePosZ(5, 5)); > > window.Run(); > > } > ` > > The button is not clicked by the mouse, because LabelBox is inherited from > StaticText, in the constructor of which there is "IgnoreMouse();" > > Solution: > Add to the constructor of the LabelBox class > NoIgnoreMouse(); > > — > Reply to this email directly, view it on GitHub > <https://github.com/ultimatepp/ultimatepp/issues/273>, or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AARH237I4IERFBSYZAS2AQD3BLATPAVCNFSM6AAAAAB6K4BYB2VHI2DSMVQWIX3LMV43ASLTON2WKOZTGEYDMOJUGEYDAOA> > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> >
Author
Owner

@ortman commented on GitHub (Jun 1, 2025):

Visually, it groups UI components.
Here is an example of a program, inside LabelBox I added my class with a layout. When resizing Labelbox, the class placed inside is stretched proportionally. It works and is convenient.
Image
But the buttons are not pressed, because IgnoreMouse() is set;

<!-- gh-comment-id:2926981314 --> @ortman commented on GitHub (Jun 1, 2025): Visually, it groups UI components. Here is an example of a program, inside LabelBox I added my class with a layout. When resizing Labelbox, the class placed inside is stretched proportionally. It works and is convenient. ![Image](https://github.com/user-attachments/assets/a46010d1-7b0e-4a01-afa4-b3981c80346f) But the buttons are not pressed, because IgnoreMouse() is set;
Author
Owner

@mirek-fidler commented on GitHub (Jun 1, 2025):

The problem is that if it would not ignore mouse, it would mess up with
usuall use in layouts where inside are its sibling widgets, by consuming
theirs mouse events.

Your usage is fine, but you can either make those child layouts sublings or
just call NoIgnoreMouse for your labelboxes. No need to completely nuke
current codebase....

On Sun, Jun 1, 2025, 12:24 PM Sergey Ortman @.***>
wrote:

ortman left a comment (ultimatepp/ultimatepp#273)
https://github.com/ultimatepp/ultimatepp/issues/273#issuecomment-2926981314

Visually, it groups UI components.
Here is an example of a program, inside LabelBox I added my class with a
layout. When resizing Labelbox, the class placed inside is stretched
proportionally. It works and is convenient.
image.png (view on web)
https://github.com/user-attachments/assets/a46010d1-7b0e-4a01-afa4-b3981c80346f


Reply to this email directly, view it on GitHub
https://github.com/ultimatepp/ultimatepp/issues/273#issuecomment-2926981314,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AARH23ZIHUKXPYHGAO34UHD3BLIFFAVCNFSM6AAAAAB6K4BYB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMRWHE4DCMZRGQ
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:2926991410 --> @mirek-fidler commented on GitHub (Jun 1, 2025): The problem is that if it would not ignore mouse, it would mess up with usuall use in layouts where inside are its sibling widgets, by consuming theirs mouse events. Your usage is fine, but you can either make those child layouts sublings or just call NoIgnoreMouse for your labelboxes. No need to completely nuke current codebase.... On Sun, Jun 1, 2025, 12:24 PM Sergey Ortman ***@***.***> wrote: > *ortman* left a comment (ultimatepp/ultimatepp#273) > <https://github.com/ultimatepp/ultimatepp/issues/273#issuecomment-2926981314> > > Visually, it groups UI components. > Here is an example of a program, inside LabelBox I added my class with a > layout. When resizing Labelbox, the class placed inside is stretched > proportionally. It works and is convenient. > image.png (view on web) > <https://github.com/user-attachments/assets/a46010d1-7b0e-4a01-afa4-b3981c80346f> > > — > Reply to this email directly, view it on GitHub > <https://github.com/ultimatepp/ultimatepp/issues/273#issuecomment-2926981314>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AARH23ZIHUKXPYHGAO34UHD3BLIFFAVCNFSM6AAAAAB6K4BYB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMRWHE4DCMZRGQ> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@ortman commented on GitHub (Jun 1, 2025):

Now I understand why this default property cannot be changed. Thank you very much for the explanation.

<!-- gh-comment-id:2927037508 --> @ortman commented on GitHub (Jun 1, 2025): Now I understand why this default property cannot be changed. Thank you very much for the explanation.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#85
No description provided.