Odd script error
Posted: Mon May 14, 2018 3:21 am
Well, odd in my book. Would appreciate your wisdom on this.
A have a field on a form called "date" and it is populated by a global var called date_selected. So, when the form is opened the global var is copied into the "date" field. It (the global var) is also used to drive a few other things, including populating a data grid with the results of an sql query based on the date.
All works well and has done so for eons. Now, I thought I would add two button on this form with arrows going left and right to increment or decrement the date
So I started testing with some code for a left arrow (subtract a day) as follows
global date_selected, gConnectID
on mouse_up
put date_selected into it -- this is the global var
convert it to dateItems
subtract 1 from item 3 of it
convert it to long date
put it into date_selected -- put the decremented date back into the global var
put date_selected into fld "date" -- make it visible in the "date" field
go first card of stack "today" -- try and reopen this card
end mouse_up
Now this code will run all day without hiccup if I run it manually in the code window (and I've stepped through the code and it performs all the steps correctly). But... if I close the window and select the button on the form, nothing happens. The date never decrements.
If these clues are not enough to suggest what's going on I'll try creating a simple stack to demonstrate the problem and post it.
Thanks for you help
Mark
A have a field on a form called "date" and it is populated by a global var called date_selected. So, when the form is opened the global var is copied into the "date" field. It (the global var) is also used to drive a few other things, including populating a data grid with the results of an sql query based on the date.
All works well and has done so for eons. Now, I thought I would add two button on this form with arrows going left and right to increment or decrement the date
So I started testing with some code for a left arrow (subtract a day) as follows
global date_selected, gConnectID
on mouse_up
put date_selected into it -- this is the global var
convert it to dateItems
subtract 1 from item 3 of it
convert it to long date
put it into date_selected -- put the decremented date back into the global var
put date_selected into fld "date" -- make it visible in the "date" field
go first card of stack "today" -- try and reopen this card
end mouse_up
Now this code will run all day without hiccup if I run it manually in the code window (and I've stepped through the code and it performs all the steps correctly). But... if I close the window and select the button on the form, nothing happens. The date never decrements.
If these clues are not enough to suggest what's going on I'll try creating a simple stack to demonstrate the problem and post it.
Thanks for you help
Mark