The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Event Order Question
Posted: 12 Feb 07 8:09 AM
|
fiogf49gjkf0d Hi guys!
I need some help with an onchange event and when it fires.
V7 no SP.
I have written a new module with MainView, etc. for display (Licensing)
On my Licensing Details main form I have places a combobox. The data for this box comes off a simple sql RS and loop.
However, when I begin to navigate records I run into issues. The sql statement requires a hidden text field (accountid) as part of the where clause. The behavior I am seeing is that the FormOnChange event fires Before the new record hidden value changes. Thus the records are pulled for the previous account.
And here it is, the big question: What order are the events firing when I navigate (previous, back, etc.) while inside a mainview? How do I get my accountid to pop before running my FormOnChange? ... I am sure it is obvious as heck, but I have burned too much time on what should be a simple logic issue. (oh, the shame)
Is there a better way to handle this?
Carla
|
|
|
|
Re: Event Order Question
Posted: 12 Feb 07 11:40 AM
|
fiogf49gjkf0d Are the text field and combobox on the same form? If so then the accountid will update immediately preceeding the OnChange event. I believe OnChange fires AFTER the form updates the underlying control binded properties with their database values. Immediately following that, bound control's OnChange event triggers. If the controls aren't on the same form and one happens to be on the mainview itself then you're most likely going to run into the symptom you're seeing: it "knowing" the last db value instead of what's current.
I believe the hidden text field trick is used by the Account Detail screen to update the address memo. There's also a hidden accountid field there as well (these are v6.2 forms, I believe v7 shouldn't be that different). |
|
|
| |
|
Re: Event Order Question
Posted: 12 Feb 07 12:37 PM
|
fiogf49gjkf0d You can change the order that the controls are created. Moving a control higher up on the creation list should make it's bindings fire before those that are lower on the list.
Right click on the form, there is a menu option there called something like "Control Creation Order". In the dialog that opens, select your hiddel label and then move it up on the list.
Give that a try and let me know if it doesn't work. |
|
|
|
Re: Event Order Question
Posted: 12 Feb 07 1:14 PM
|
fiogf49gjkf0d Spot On.
"Ryan: The One Click King"
I can't believe how much time I wasted trying to find this one... That will teach me not to ask sooner. Expect a blast of them - my deadline is coming up FAST!
c |
|
|
|