Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
phaworth
- Posts: 592
- Joined: Thu Jun 11, 2009 9:51 pm
Post
by phaworth » Sun Feb 07, 2010 1:57 am
I have a button on card A which when clicked should use the send command to send a mouseUp event to a button on card B. I've done this by issuing the send command followed by a go command.
If card B is already open, this works fine. If card B has not yet been opened in the current run of the application, it doesn't open. If card B has been opened at least once during the current run but then closed again, this works.
The code looks like this:
Code: Select all
send "mouseUp mySQL" to button "triggerFilterButton" of card "DB_Places" of stack "Places"
go stack "Places"
I've also tied using the go command to a the card within the stack (there'sonly one crd in the stack). I've tried issuing the go command before the send command - same problem
ANy ideas?
Thanks,
Pete
-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Sun Feb 07, 2010 11:52 am
Hello,
I think that the problem might be in your script... try
Code: Select all
send "mouseUp" to button "triggerFilterButton" of card "DB_Places" of stack "Places"
go stack "Places"
without having MySQL behind 'mouseUp'
I have just created a stack which has two cards named, 'A' and 'B'... On each card there is a button named 'A' and 'B' respectively. In the script of button 'A' on card 'A', I placed
Code: Select all
on mouseUp
send "mouseUp" to button "B" of card "B"
go card "B"
end mouseUp
In the script of button 'B' of card 'B", I placed
Code: Select all
on mouseUp
put "This is a message from button B on card B"
end mouseUp
Rev goes to card 'B' and the response appears in the message box every time... it does not matter if it is run on opening the stack or if the stack has been opened and the cards have been visited...
be well
Dixie
-
phaworth
- Posts: 592
- Joined: Thu Jun 11, 2009 9:51 pm
Post
by phaworth » Sun Feb 07, 2010 6:50 pm
Thanks for the suggestion. I tried it without passing the mySQL parameter but still getting the same problem. Useful to try but it turns out I have to pass in the mySQL parameter for the logic of my app to work, unless I can find another way to hand mySQL off to the button in question.
Pete
-
bn
- VIP Livecode Opensource Backer

- Posts: 4171
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sun Feb 07, 2010 7:33 pm
Pete,
if you want to send a parameter with your command you could put a comand in the receiving button "triggerFilterButton" like this:
Code: Select all
on triggerMyFilter tMySQL
put tMySQL into field 1
-- do whatever you want with tMySql
end triggerMyFilter
in the sending stack you put
Code: Select all
on mouseUp
put "this is a test" into tParameter
send triggerMyFilter && tParameter to btn "triggerFilterButton" of card 1 of stack "Places"
end mouseUp
Probably your button "triggerFilterButton" has a routine to work on mySQL, you could break that out in the button to let the "triggerMyFilter" handle it. The tMySQL would be passed from the mouseUp handler along with the command.
or you could use a global variable to make mySQL accessible to your receiving button, but I don't like global variables, it is easy to loose track of what handler fills them and when.
regards
Bernd
-
phaworth
- Posts: 592
- Joined: Thu Jun 11, 2009 9:51 pm
Post
by phaworth » Sun Feb 07, 2010 7:50 pm
Thanks Bernd. I've been working on this today and have put what used to be in the mySQL variable into a custom property of the target of the send command. That all works well but I still have the same issue with the from not opening.
If it sheds any further light on this, when I do this in the standalone app version of my application, I get the error dialog box and the details supplied in the Email option are:
Executing at 10:48:08 AM on Sunday, February 7, 2010
Type: Handler: error in statement
Object: group 'PlacesGrid' of group 'DB_Places' of card 'DB_Places' of stack 'Places' of stack '/Applications/BandTrak/BandTrak.app/Contents/MacOS/BandTrak'
Line:
Line Num: 0
Hint: -8
One thing I would like to do is somehow trace all the vents that occur after I click on the original button that sets this whole process in motion. Is there a way to trace events in the debug tool?
Thanks,
Pete
-
Klaus
- Posts: 14191
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Feb 07, 2010 7:58 pm
Hi Pete, Dixie and Bernd,
you CAN pass a (string) parameter to "mouseup", I am doing this in our current project successfully!
"Normally" you only pass a number (the mousebutton actually clicked 1, 2 or 3) but you can also pass a string if necessary:
Code: Select all
on mouseup tParam
put tParam into fld "whatever"
### more mouseup stuff here...
end mouseup
Sorry, no idea about the other problems you have.
Best
Klaus
-
bn
- VIP Livecode Opensource Backer

- Posts: 4171
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sun Feb 07, 2010 8:01 pm
Pete,
in the IDE you can use the Message Watcher in the Development Menu. It lists, well, the messages.
I don't know if this helps.
@ Klaus, good to know, I thought it was always the the mouseButtonNumber that were passed to mouseUp
regards
Bernd
-
Klaus
- Posts: 14191
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Feb 07, 2010 8:07 pm
Hi Bernd,
well, this is USUALLY the case.
But I simply tried it, it worked, so I use it when needed

-
phaworth
- Posts: 592
- Joined: Thu Jun 11, 2009 9:51 pm
Post
by phaworth » Mon Feb 08, 2010 6:47 pm
Thanks for all the advice, I think I've fixed the problem now. There was some code that was being executed in the openCard handler of "card B" that I think was causing problems with the execution of the code I was sending the mouseUp message to. I still don;t fully understand exactly what was going on but after fixing that issue, all seems to be working well now.
Pete
-
mwieder
- VIP Livecode Opensource Backer

- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
-
Contact:
Post
by mwieder » Mon Feb 08, 2010 7:21 pm
phaworth wrote:
One thing I would like to do is somehow trace all the vents that occur after I click on the original button that sets this whole process in motion. Is there a way to trace events in the debug tool?
If you're using glx2 then you should have that info available. The IDE's error reporting is fairly terse about this. But if you want to handle the errorDialog message yourself then you can print out the executionContexts, which will give you the call stack, both in the IDE and in a standalone.