stam66 / placeholderField

A liveCode script widget that allows placeholder/hint text (optionally animated) and password field function
MIT License
0 stars 0 forks source link

Unable to set traversalOn of the widget from within it's code #1

Closed stam66 closed 10 months ago

stam66 commented 10 months ago

Externally the traversalOn of the widget can be set with no issues (eg via the msgBox).

Internally, the traversalOn is governed by the widgetTraversalOn property, whose setter directs to updateVisualControls. The traversalOn of the widget be set in UpdateVisualControls, but doing that causes the widget to not render until resized. Doing this in other handlers allows it to render but widgetTraversalOn then has no effect.

BerndN commented 10 months ago

change handler setTraversalOn to

command setTraversalOn
    set the traversalOn of the owner of me to the widgetTraversalOn of me
end setTraversalOn

Note the traversalOn of the owner of me instead of the traversalOn of me

There is something going on with referencing in Script Widgets https://quality.livecode.com/show_bug.cgi?id=24455

change handler openControl to

on openControl
    if not sHasCreatedVisuals then createVisualControls
    updateVisualControls
    resizeFields
    send "setTraversalOn" to me in 50 milliseconds
end openControl
stam66 commented 10 months ago

Thanks Bernd! I can confirm that now works for me as well :) I had also tried both the traversalOn of me and the traversalOn of the owner of me - but that didn't work, probably because I was not calling from the correct handler. I had it initially in the updateVisualControls handler and it didn't but calling it from openControl does!

Thank you also for submitting the bug report, I've added myself as cc. I like script widgets but it needs a lot of polish still I think!