Something strange...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Something strange...
Hi everyone,
I am building a very simple stack with a few buttons and text fields. After I get everything the way I want it, I group all objects so that they will behave like background objects visible on all (newly-added) cards. The problem is that after I group everything, if I click anywhere on the BACKGROUND (non-button/field area), it executes the script from the last button I added. It's as though the card has adopted the script of that last button. I am using LC Indy 8.1.4.
I am not sure if I am making sense but can someone help me? I am sure it's something stupid I am overlooking.
Thank you,
Jon
I am building a very simple stack with a few buttons and text fields. After I get everything the way I want it, I group all objects so that they will behave like background objects visible on all (newly-added) cards. The problem is that after I group everything, if I click anywhere on the BACKGROUND (non-button/field area), it executes the script from the last button I added. It's as though the card has adopted the script of that last button. I am using LC Indy 8.1.4.
I am not sure if I am making sense but can someone help me? I am sure it's something stupid I am overlooking.
Thank you,
Jon
Re: Something strange...
I got it figured out. For some reason the group was assuming the script of the last button.
Weird.
Weird.
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Something strange...
Hi.
If you are trapping a mouseUp message outside the extent of the group, that is, by clicking outside that group, there must be a handler in the card script or above.
So have you really figured it out? Write back. I am curious.
Craig Newman
The group script will not, on its own, inherit the script of any child control. A "mouseUp" message, if not trapped, will pass from the target through the hierarchy of the message path.For some reason the group was assuming the script of the last button.
If you are trapping a mouseUp message outside the extent of the group, that is, by clicking outside that group, there must be a handler in the card script or above.
So have you really figured it out? Write back. I am curious.
Craig Newman
Re: Something strange...
Hi Craig,
Thank you for the reply. As best I can tell, the issue appears to be resolved. In the project browser, I remember seeing that the GROUP had 23 lines of code in it which is the same amount the last button I added has. Once I removed the script from the group, the issue went away. And yes, the buttons all have mouseUp. As I am somewhat new to LC, I still have a lot to learn (I got used to HyperCard and it's hierarchy back in the day).
Off the subject, how does one make custom dialog boxes in LC?
Thank you,
Jon
Thank you for the reply. As best I can tell, the issue appears to be resolved. In the project browser, I remember seeing that the GROUP had 23 lines of code in it which is the same amount the last button I added has. Once I removed the script from the group, the issue went away. And yes, the buttons all have mouseUp. As I am somewhat new to LC, I still have a lot to learn (I got used to HyperCard and it's hierarchy back in the day).
Off the subject, how does one make custom dialog boxes in LC?
Thank you,
Jon
Re: Something strange...
Fair example of making custom dialogs
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Something strange...
Do you mean the "phantom" mouseUp handlers that are pre-loaded withe every new button? Just as in HC, these are not compiled until you say so. I only mention this because the group script is normally the right place for such things, using the "target" to identify the button of interest. Just like HC might use the backGround script. They both have the card layer, of course.And yes, the buttons all have mouseUp.
The message hierarchy for LC is much the same as for HC. There is no background object class in LC, and there are no groups in HC. Otherwise you should be pretty comfortable.(I got used to HyperCard and it's hierarchy back in the day).
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Something strange...
In LC a group can be made compatible with HC by setting the backgroundBehavior property to true. Once set, new cards will include the background group, and the group will change its place in the message path to be after the card as HC does.dunbarx wrote:The message hierarchy for LC is much the same as for HC. There is no background object class in LC, and there are no groups in HC.(I got used to HyperCard and it's hierarchy back in the day).
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
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Something strange...
What Richard said about backGround behavior. But the difference between HC and LC in this regard is profound, and unlearning takes a bit of practice.
The other main difference is how menus are managed. HC had "native" menu objects, whereas LC uses groups of buttons with certain group properties set. All just takes getting used to.
Craig
The other main difference is how menus are managed. HC had "native" menu objects, whereas LC uses groups of buttons with certain group properties set. All just takes getting used to.
Craig
Re: Something strange...
Hi all,
Thank you for your replies. This is good information!
One more question and I fear the answer but the stack I am building is an extremely simple one with a few buttons and text fields which will be compiled into a Windows app. The app is basically a simple database of employees and their skills. Each employee gets there own card. After compiling, I fill out one card, click a button to create a second card, and fill out that card. When I close and reopen the app, all the changes I made were not kept. How do I make the app keep my changes?
Thank you,
Jon
Thank you for your replies. This is good information!
One more question and I fear the answer but the stack I am building is an extremely simple one with a few buttons and text fields which will be compiled into a Windows app. The app is basically a simple database of employees and their skills. Each employee gets there own card. After compiling, I fill out one card, click a button to create a second card, and fill out that card. When I close and reopen the app, all the changes I made were not kept. How do I make the app keep my changes?
Thank you,
Jon
Re: Something strange...
OOh, ooh, let me see if I (finally) got this one !
All the 'cards' have to be on a separate stack, which is saved as a stack (not an executable). Then you have to call that stack from your main application stack, like this lesson shows.
All the 'cards' have to be on a separate stack, which is saved as a stack (not an executable). Then you have to call that stack from your main application stack, like this lesson shows.
Re: Something strange...
Hi bogs (and everyone else),
I got it working!!! Thank you! Changes are now saved!
I have everything working....except one thing. For some reason, after the app is built, one button does nothing when I click it. I have confirmed that a script is present and that it works in the native stack. It's noteworthy that when I build the app for Mac, the button works but not when it's built for Windows (which is where the app will be used). Here's the script of the button.
on mouseUp
ask "Please enter an employee name:"
put it into theEmployee
if theEmployee is empty then exit mouseUp
put number of cards into cardNumber
put number of this card into thisCard
lock screen
repeat for cardNumber
if fld "Employee Name" ≠ theEmployee then
go next
else
exit repeat
end if
end repeat
unlock screen
get number of this card
if it = thisCard then
answer "No employee found by that name."
end if
end mouseUp
Perhaps there's something in the above script that Windows doesn't like?
Any ideas?
Jon
I got it working!!! Thank you! Changes are now saved!
I have everything working....except one thing. For some reason, after the app is built, one button does nothing when I click it. I have confirmed that a script is present and that it works in the native stack. It's noteworthy that when I build the app for Mac, the button works but not when it's built for Windows (which is where the app will be used). Here's the script of the button.
on mouseUp
ask "Please enter an employee name:"
put it into theEmployee
if theEmployee is empty then exit mouseUp
put number of cards into cardNumber
put number of this card into thisCard
lock screen
repeat for cardNumber
if fld "Employee Name" ≠ theEmployee then
go next
else
exit repeat
end if
end repeat
unlock screen
get number of this card
if it = thisCard then
answer "No employee found by that name."
end if
end mouseUp
Perhaps there's something in the above script that Windows doesn't like?
Any ideas?
Jon
Re: Something strange...
Hi Jon,
yep, this line is the culprit:
...
if fld "Employee Name" ≠ theEmployee then
...
This "not equal" character - ≠ is Mac-only so the script will fail on Windows at this line!
For cross-platform development use <> (smaller greater) for "not equal".
Best
Klaus
yep, this line is the culprit:
...
if fld "Employee Name" ≠ theEmployee then
...
This "not equal" character - ≠ is Mac-only so the script will fail on Windows at this line!
For cross-platform development use <> (smaller greater) for "not equal".
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Something strange...
And this is why it is so important to test standalones thoroughly. If the issue you saw here had occurred in the stack script, the whole program might have just failed, and there would be no indicaton of what went wrong. At least in the IDE, there are powerful tools that tell you where to look.
Craig
Craig
Re: Something strange...
Klaus - yep, that fixed it! I should have known that. Even back in my HyperCard days, I always used the <> for not equal!
Craig - yes, I am aware of the importance of testing the standalone. While this particular app is extremely simple, it has been compiled several times to test each buttons functionality. With your and others help, I figure this app qualifies as beta now.
Thanks so much,
Jon
Craig - yes, I am aware of the importance of testing the standalone. While this particular app is extremely simple, it has been compiled several times to test each buttons functionality. With your and others help, I figure this app qualifies as beta now.
Thanks so much,
Jon
Re: Something strange...
Craig, I'm 100% with you on testing as rigorously as possible, but curious if something like this particular problem would have been caught in the IDEs tools?
In other words, lets say cmhjon develops on a mac, where the symbol Klaus points out is acceptable for use. The IDE will just run it and show no errors, wouldn't it? I ask, because I am far from an expert with the debugger in Lc, for all I know it may jump up and tell you so, or there may be some other tool that would do it ?
On the other side of this, though, that symbol does not exist in the Lc dictionary as far as I can tell, you may just want to limit your code to listed symbols, and if in doubt make sure to check the "Supported Operating Systems:" section until you are super proficient in what will and won't fly
In other words, lets say cmhjon develops on a mac, where the symbol Klaus points out is acceptable for use. The IDE will just run it and show no errors, wouldn't it? I ask, because I am far from an expert with the debugger in Lc, for all I know it may jump up and tell you so, or there may be some other tool that would do it ?
On the other side of this, though, that symbol does not exist in the Lc dictionary as far as I can tell, you may just want to limit your code to listed symbols, and if in doubt make sure to check the "Supported Operating Systems:" section until you are super proficient in what will and won't fly