No messages in widgets?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9582
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
No messages in widgets?
Hermann mentioned this to me in another thread. I wrote:
...Messages seem to be blocked in a widget. Even rawKeyDown.
So there is no communication between the LC script and LC builder worlds???
Anyone? Does this seem reasonable? I am not able to determine if the cursor simply enters the widget rect itself? The widget has a script, but that is rather limited in usefulness if no messages can be trapped.
Is it inherent in the nature of widgets?
Craig
...Messages seem to be blocked in a widget. Even rawKeyDown.
So there is no communication between the LC script and LC builder worlds???
Anyone? Does this seem reasonable? I am not able to determine if the cursor simply enters the widget rect itself? The widget has a script, but that is rather limited in usefulness if no messages can be trapped.
Is it inherent in the nature of widgets?
Craig
Re: No messages in widgets?
Hi Craig,
as far as I understand this, widget will only support those messages, that the deveolper had implemented in the widget.
"mouse" messages are however said to work in all widgets:
https://quality.livecode.com/show_bug.cgi?id=21480
Best
Klaus
as far as I understand this, widget will only support those messages, that the deveolper had implemented in the widget.
"mouse" messages are however said to work in all widgets:
https://quality.livecode.com/show_bug.cgi?id=21480
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9582
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: No messages in widgets?
Klaus and all:
I just read:
http://forums.livecode.com/viewtopic.ph ... 46#p126346
This was written several years ago, but details most of the issue.
The one thing I picked out in the first post above, that seems to have been in LCMark's mind, was that the script object of a widget in particular might naturally be seen as a place for "general purpose" messages to be trapped, that is, those not explicitly included by the widget author.
Mark makes the point, which I see the merit of, that the ability to trap any old message might break something in the widget itself, if it explicitly did not include it, or handled it at a lower level within LCB.
Apparently, this has not gone much further since then.
Craig
I just read:
http://forums.livecode.com/viewtopic.ph ... 46#p126346
This was written several years ago, but details most of the issue.
The one thing I picked out in the first post above, that seems to have been in LCMark's mind, was that the script object of a widget in particular might naturally be seen as a place for "general purpose" messages to be trapped, that is, those not explicitly included by the widget author.
Mark makes the point, which I see the merit of, that the ability to trap any old message might break something in the widget itself, if it explicitly did not include it, or handled it at a lower level within LCB.
Apparently, this has not gone much further since then.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: No messages in widgets?
Craig and Klaus.
All mouse messages are blocked by LCB if the author doesn't implement them.
See the line-graph widget source, no handler begins with OnMouse:
https://github.com/livecode/livecode/bl ... /graph.lcb
TMHO this is exactly the correct way, else I had to block everything I don't want or can't have in my widget. This is NOT a bug.
For example if you draw sliders as in my color picker widget, then you can't accept any other mouseEvent for the user:
If you have built a Porsche (LCB 9 has become pretty fast with a lot of things) then you don't want to add a trailer with all possible camping stuff for the users.
As long as it is open source, there is no problem with that. We have the source and we are developers.
So we can write our own and pass the mouse events we would like to play with.
Also there are not-to-hard ways in LC Script to work around not-sent-messages.
What widget authors should do is to describe in every widget for the Docs which messages are supported (all others are not).
All mouse messages are blocked by LCB if the author doesn't implement them.
See the line-graph widget source, no handler begins with OnMouse:
https://github.com/livecode/livecode/bl ... /graph.lcb
TMHO this is exactly the correct way, else I had to block everything I don't want or can't have in my widget. This is NOT a bug.
For example if you draw sliders as in my color picker widget, then you can't accept any other mouseEvent for the user:
If you have built a Porsche (LCB 9 has become pretty fast with a lot of things) then you don't want to add a trailer with all possible camping stuff for the users.
As long as it is open source, there is no problem with that. We have the source and we are developers.
So we can write our own and pass the mouse events we would like to play with.
Also there are not-to-hard ways in LC Script to work around not-sent-messages.
What widget authors should do is to describe in every widget for the Docs which messages are supported (all others are not).
shiftLock happens
Re: No messages in widgets?
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: No messages in widgets?
No. He is right.
Because these messages ARE "forwarded" to LC Script by the svg-icon-path widget.
That's what I say.
Because these messages ARE "forwarded" to LC Script by the svg-icon-path widget.
- mouseDown
- mouseUp
- mouseDoubleUp
- mouseEnter
- mouseLeave
That's what I say.
I'll start with it in my widgets right now.What widget authors should do is to describe in every widget for the Docs which [mouse] messages are supported (all others are not).
shiftLock happens
Re: No messages in widgets?
Aaa, thank you.
Still a littele puzzeld, so e.g. the SVG widget simply "passes" (like in a LCS) these messages, so the IDE/LCS/WE can handle them (or not)?
Still a littele puzzeld, so e.g. the SVG widget simply "passes" (like in a LCS) these messages, so the IDE/LCS/WE can handle them (or not)?
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: No messages in widgets?
Exactly. In LCB this is called script access (not allowed in all handlers!).
A message is "forwarded/passed" to the scriptObject (=by default the widget) with "post", for example from the source code of the svg-icon-path widget (comments by me):
Moreover to key events:
A message is "forwarded/passed" to the scriptObject (=by default the widget) with "post", for example from the source code of the svg-icon-path widget (comments by me):
Code: Select all
public handler OnMouseUp() -- the widget receives the message in LCB
if the click count is 2 then
post "mouseDoubleUp" with [the click button formatted as string]
--> you can script "on mouseDoubleUp tBtn"
--> in the widget script or card script or ... (up)
else
post "mouseUp" with [the click button formatted as string]
--> you can script "on mouseUp tBtn"
--> in the widget script or card script or ... (up)
end if
end handler
That's why we have not (yet) keyboard support in LCB. So no key event reaches a widget and thus, from the same logic as for mouse events, no key event can be "forwarded/passed" to LC Script.Craig wrote:Messages seem to be blocked in a widget. Even rawKeyDown.
shiftLock happens
Re: No messages in widgets?
Thank you for the clarification and explanation!
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: No messages in widgets?
What a praise! By Klaus! But I forgot to remarkKlaus wrote:Thank you for the clarification and explanation!
A widget is not an ordinary control ...
shiftLock happens
Re: No messages in widgets?
Hi Hermann,
Best
Klaus
don't pride yourself on that!
I NEVER would have doubted this!
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9582
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: No messages in widgets?
Hmmm.
Craig
The SVG widget does indeed respond to a mouseUp handler in the widget script. But the line graph does not. So is there a list of trappable messages for the stock widgets in the tool palette?Because these messages ARE "forwarded" to LC Script by the svg-icon-path widget.
mouseDown
mouseUp
mouseDoubleUp
mouseEnter
mouseLeave
no other mouse event.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: No messages in widgets?
Craig.
There is no list. One has to look into the source code (lcb-file), I have at the moment no time to do that for all widgets.
Here is the method in case somebody takes the time.
If there is none, then no mouseEvent is passed, no chance to catch it.
Hermann
There is no list. One has to look into the source code (lcb-file), I have at the moment no time to do that for all widgets.
Here is the method in case somebody takes the time.
- Go to https://github.com/livecode/livecode/tr ... ns/widgets
or the extensions folder of your app folder (in Contents). - Open a widget folder
- Open the lcb file with a text editor (in GitHub click raw).
- Search for "OnMouse" (or directly for "post " and "execute script ")
- Look in the found public handler whether there is a line that begins with post "mouse" or "execute script" (containing a LCS mouse handler)
If there is none, then no mouseEvent is passed, no chance to catch it.
Hermann
shiftLock happens