Answer function
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Answer function
If the OP was, as Mark wondered, using his own custom "answer" dialog, then all bets are off. No mystery, apart from whatever went awry.
But I will bet a dime that the ordinary dialog was used, but that the problem came a bit afterwards. This requires looking at the handlers.
Craig
But I will bet a dime that the ordinary dialog was used, but that the problem came a bit afterwards. This requires looking at the handlers.
Craig
Re: Answer function
I have a stack separate from the main stack but I associate it by ‘start using’ on startup. It contains configuration data and drawings which are displayed as an overlay palette on the main stack. This data stack has a mouseUp script so that users can click on the drawings to perform certain actions, the mouseUp sends commands to the card behind it in the main stack.
As I had closed the data stack I was not expecting it to take any further part in proceedings, but it appears the ‘answer’ buttons were sending a mouseUp to the closed stack, which was then sending its message to the main stack and confusing it. I am using ‘answer’ as is, nothing fancy.
As I had closed the data stack I was not expecting it to take any further part in proceedings, but it appears the ‘answer’ buttons were sending a mouseUp to the closed stack, which was then sending its message to the main stack and confusing it. I am using ‘answer’ as is, nothing fancy.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Answer function
Which system messages are handled in that library?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Answer function
"start using" a stack won't mess up the message path for mouseUp messages that way.
Using the data stack script as a frontscript will.
Check to make sure you haven't inserted the stack script as a frontscript.
Using the data stack script as a frontscript will.
Check to make sure you haven't inserted the stack script as a frontscript.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Answer function
I haven’t even investigated frontscripts yet. The data stack seems to have a life of its own whether its open or not.
Re: Answer function
Nope. Not unless you tell it to, and that would have to be explicitly done after the answer dialog has closed, with the selection from the dialog button having been placed automatically into the local variable "it".but it appears the ‘answer’ buttons were sending a mouseUp to the closed stack,
What did you do on the lines immediately following the "answer" command line?
Craig
Re: Answer function
Sorry to contradict you, but I know what I found. In the script with the the ‘answer’ command, I placed a ‘put it’ directly after the answer command, but it locked up without showing ‘it’, so I know it never got there. Then I found that if I disabled the mouseUp message from the ‘data’ stack, i.e. stopped it sending the command to the main stack, but putting a ‘put “mouseUp received” ‘ line in the script, I saw this was triggered by the buttons in the answer box. Without the spurious transferred message to the main stack, the system no longer locked up.
The cure was then simple, I just blocked onward messages from the data stack if the trigger target was a button, as I never use buttons in the data stack cards.
The cure was then simple, I just blocked onward messages from the data stack if the trigger target was a button, as I never use buttons in the data stack cards.
Re: Answer function
I have been contradicted so often (usually with good reason) that no apologies are necessary.
When you "put it" into the line immediately following the answer command line, were you stepping through the code at the time? I have been interested, when stepping through, which line crashed LC.
This is all detective work, and I will bet another dime that when we find the culprit, everyone will say, "of course". You too.
What is this?
If you can, this may all be easier if you can post some of the pertinent code.
Craig
When you "put it" into the line immediately following the answer command line, were you stepping through the code at the time? I have been interested, when stepping through, which line crashed LC.
This is all detective work, and I will bet another dime that when we find the culprit, everyone will say, "of course". You too.

Now then, I have no idea what this could be, or why you think a "mouseUp" message could be sent that way.I saw this was triggered by the buttons in the answer box.
What is this?
And what did you write, in-line? The actual string "put “mouseUp received"? If you did, what was the condition that made that fire? The reason I ask is that, on its own, LC would put the string “mouseUp received" into the message box.but putting a ‘put “mouseUp received” ‘ line in the script, I saw this was triggered by the buttons in the answer boxI
If you can, this may all be easier if you can post some of the pertinent code.
Craig
Re: Answer function
I don’t think any further detective work is required. If an answer box is displayed, then when either button is pressed, it sends a mouseUp message which filters through to a ‘closed’ stack. If that stack contains a mouseUp handler, then the code in that handler will be actioned. No mystery, that’s just what happens.
Re: Answer function
It isn't, actually.
But if you've got something that's working for you, great. Let's move on.
But if you've got something that's working for you, great. Let's move on.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Answer function
It is - actually. A ‘put the target’ message I put into the mouseUp handler in the closed stack to intercept it shows that the target was button “Yes” if that was pressed, or button “No” if that was pressed, so that shows conclusively it was coming from the Answer box.
Re: Answer function
I cannot tell if we are off in the weeds or not.
On a new card with a button, and this in the button script:
This is what is shown in the message watcher, with "mouseEnter", "mouseLeave" and "mouseMove" suppressed:
The "mouseDown" and "mouseUp" messages are sent before the dialog is rendered. No messages at all are sent when a dialog button is selected, and of course the dialog is automatically dismissed.
If I uncomment the "mouseDown" handler, leaving both "active", the message watcher shows: "MouseUp" never even fires.
All this was to prove to me that an answer dialog does ONE thing well. It places the text of the selected button into the local variable "it", and then conveniently disappears. My confusion in all this entire discussion centers around a "mouseUp" message purportedly being sent down the message path, from the dialog, based on the button clicked on.
I don't get it.
Craig
On a new card with a button, and this in the button script:
Code: Select all
on mouseUp
answer "X" with "Y" or "Z"
end mouseUp
--on mouseDown
-- answer "A" with "B" or "C"
--end mouseDown
If I uncomment the "mouseDown" handler, leaving both "active", the message watcher shows: "MouseUp" never even fires.
All this was to prove to me that an answer dialog does ONE thing well. It places the text of the selected button into the local variable "it", and then conveniently disappears. My confusion in all this entire discussion centers around a "mouseUp" message purportedly being sent down the message path, from the dialog, based on the button clicked on.
I don't get it.
Craig
Re: Answer function
Just to make sure, because I often do not know what I am talking about, I placed a "mouseUp" handler in the card script, to see if any such message snuck through after clicking the answer dialog button. I assumed that this would be the best place to trap any such varmint.
Nothing.
Of course.
@Odysseus. We are all obviously misunderstanding what you are doing. I have no doubt you are seeing what you are seeing. But I have no idea what you are seeing.
Craig
Nothing.
Of course.
@Odysseus. We are all obviously misunderstanding what you are doing. I have no doubt you are seeing what you are seeing. But I have no idea what you are seeing.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Answer function
No doubt. But the question is how? The answer dialog mouseup message isn't passed.odysseus wrote: ↑Fri Nov 13, 2020 11:09 amIt is - actually. A ‘put the target’ message I put into the mouseUp handler in the closed stack to intercept it shows that the target was button “Yes” if that was pressed, or button “No” if that was pressed, so that shows conclusively it was coming from the Answer box.
Mark's question about frontscripts seems relevant.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Answer function
My bad - everything I posted was correct EXCEPT its mouseDown that does it not mouseUp, sorry.
Just to double check it wasn't any of my code,I set up a new system with two stacks, stack 1 includes 'start using' stack 2. Stack 2 has a mouseDown handler which just says 'put the target'. That captures the answer buttons triggered from stack 1. It all doesn't matter now I know, but it might catch someone out in the future - who knows?
Just to double check it wasn't any of my code,I set up a new system with two stacks, stack 1 includes 'start using' stack 2. Stack 2 has a mouseDown handler which just says 'put the target'. That captures the answer buttons triggered from stack 1. It all doesn't matter now I know, but it might catch someone out in the future - who knows?