Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Visibility Funny
Tue, Feb 16 2016 12:43 PMPermanent Link

Mark Brooks

Slikware

Avatar

All

I have a scenario where I allow a user to click a label in order to do something. In some cases, the label is hidden via the Hide method when it's not applicable. However, clicking in it's location (even though t's not visible) still fires the OnClick event as if it was visible!

Anybody else come across this?
Tue, Feb 16 2016 12:45 PMPermanent Link

Matthew Jones

<Mark Brooks> wrote:
> All
>
> I have a scenario where I allow a user to click a label in order to do
> something. In some cases, the label is hidden via the Hide method when
> it's not applicable. However, clicking in it's location (even though t's
> not visible) still fires the OnClick event as if it was visible!
>
> Anybody else come across this?
>
>

Just like Delphi- you have to set enabled to false too.

--
Matthew Jones
Tue, Feb 16 2016 2:18 PMPermanent Link

Mark Brooks

Slikware

Avatar

Potentially hanging head in shame ..... I may be triggering the bloody thing myself with another bit of code that doesn't take the visibility into account (this is all happening inside a custom component). Will check.
Tue, Feb 16 2016 2:40 PMPermanent Link

Mark Brooks

Slikware

Avatar

Yup. My bad. Apologies.

Basically, I have elements within a visual component that hide themselves if not relevant. I also have a click-handler for the component that works out what element was clicked based on the X and Y coords. However, it wasn't taking into account the element's visibility.

Maybe there's a better way to handle this?
Thu, Feb 18 2016 11:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< Basically, I have elements within a visual component that hide themselves if not relevant. I also have a click-handler for the component that works out what element was clicked based on the X and Y coords. However, it wasn't taking into account the element's visibility.

Maybe there's a better way to handle this? >>

Is this a custom control/component ?  If so, then you should look at this method for intercepting events for a given sub-element:

(WebCtrls unit - TControl class)

function DispatchEvent(ID: Integer; AElement: TElement): Boolean; override;

It will allow you intercept all key, mouse, and touch events for any elements that are nested within the current control's base UI element.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Feb 20 2016 6:37 AMPermanent Link

Mark Brooks

Slikware

Avatar

Tim Young [Elevate Software] wrote:

>Is this a custom control/component ?  If so, then you should look at this method for intercepting events for a given >sub-element:

>(WebCtrls unit - TControl class)

>function DispatchEvent(ID: Integer; AElement: TElement): Boolean; override;

>It will allow you intercept all key, mouse, and touch events for any elements that are nested within the current >control's base UI element.

Hey Tim

Yup, I think this is likely much preferable. The scenario is indeed a custom component that has a number of child elements that show / hide themselves based on status. I was using the X,Y coordinates of the parent at the point of click / touch to work out which child had actually been clicked / touched. My code did not check to see if the child was visible. I imagine that using DispatchEvent removes that issue immediately, since no event would be triggered for an invisible child!

I've attached a grab from a section of the app view and highlighted the actual component. It has a thumbnail of a document, some textual details and some buttons. I arrange the parent within a scroller using overflow to handle screen sizes. Hope this makes sense.

Regards
Mark



Attachments: Portal Grab.png
Mon, Feb 22 2016 2:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< I imagine that using DispatchEvent removes that issue immediately, since no event would be triggered for an invisible child! >>

I can't commit to that. Smile If the browser triggers the event on the element, then it will get dispatched, period.  So, this aspect is up to the browser.

<< I've attached a grab from a section of the app view and highlighted the actual component. It has a thumbnail of a document, some textual details and some buttons. I arrange the parent within a scroller using overflow to handle screen sizes. >>

Yep, that's basically what I imagined.

Nice UI.  Look at those crisp icons. Wink

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Feb 22 2016 5:08 PMPermanent Link

Mark Brooks

Slikware

Avatar

Tim Young [Elevate Software] wrote:.

>>Nice UI.  Look at those crisp icons. Wink

Thanks. Took me literally hours to "craft" them ......
Image