is a panel "transparent" to clicks?

vangogh

Active Member
Licensed User
Longtime User
I have an activity full screen, with labels and buttons (and related events). call this Panel1

then in the same activity I open a panel2, full screen, I say "bringtofront", so I completely conver the previous panel1

but...

... if I touch the panel2 in a position where, "under the panel2", there is a button1 in panel1 (that now it's invisible!)... I RAISE the button1_click event!
 

vangogh

Active Member
Licensed User
Longtime User
under panel2 I have the "main" activity himself - no panels, but "almost all the views - but the panels"

I cannot say "background.visible=false"

Have I to create a background panel where I put almost all????:sign0137:


BUT

If the panel2 covers only part of the activity (or other panels), I cannot hide the other panels! I still need to "use and view" them!

when a panel is in front of another, the views under this panel (in another panel), so NOT visible, should really NOT "answer" to clicks!!! :sign0148:
I am clicking on what I am seeing
 
Last edited:
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
OK if I define a panelx_click event (empty) on every panel, the issue is solved

strange behaviour :SHOCKED:

thanx!!
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
strange behaviour
It's by design and not strange if you understand the reason for it. It's also the default behaviour in Windows Presentation Foundation. Here's one of those reasons from Routed Events Overview

Various controls in WPF have a rich content model. For example, you can place an image inside of a Button, which effectively extends the visual tree of the button. However, the added image must not break the hit-testing behavior that causes a button to respond to a Click of its content, even if the user clicks on pixels that are technically part of the image.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
I never had to deal with this problem as I keep all the panel far away from the activity window with .left = 900, and call them to display with .left = 0.
This way there are no views under the panel and no need to deal with their events.
Also this is convenient for the visual design - they do not hide each other.
 
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
mmmm:confused:

when you set panel.left=0, the panel goes "beyond" all you have on the screen in that moment (the activity panel itself), so if you click on the panel, you click on what you have under the panel...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I do it a bit different than derez.
I use panels for general buttons and specific toolboxes in the designer on the Activity layout and nothing else on it.
Then I create a layout file for each panel, the panels are added in the code and I load their layout files.
So no problem in the Designer with different panels.
As always, different aproaches and solutions for a same problem.

Best regards.
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Very interesting.
I haven't noticed this problem, but I will have to test for it.

What I do is use "bring to front".

Will this also show the "transparent click" feature?

Would using disable/enable keep clicks from being transparent? For example,

panel1.enabled = false
panel2.enabled = true
panel2.bringtofront

Barry.
 
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
>What I do is use "bring to front".
>Will this also show the "transparent click" feature?

Yes

>Would using disable/enable keep clicks from being transparent? For example,
>panel1.enabled = false
> panel2.enabled = true
> panel2.bringtofront

no.

the problem is when in the "main" screen there are no panels, so you cannot disable or hide them, or when the new panel doesn't cover completely the background because you need to access something in the back.
A simple example? a panel in the middle of the screen saying "working". if you click on that panel, you are clicking on what is in the back of the panel.
 
Upvote 0
Top