Re: Enhanced IDE control ordering
- Posted by Mike777 <anon4321 at ??ail.com> Jan 27, 2008
- 578 views
Judith Evans wrote: > > > Mike777 wrote: > > > > I have a set of two controls, a label and a checkbox. > > However, the IDE builds the exw file with the myLabel code before the > > myCheckbox > > code and then complains that myCheckbox_onClick has not been declared. > > > So I went into Generate Tools|Change control order for program and moved > > myLabel > > well below myCheckbox. The exw file is built in the same order, as if my > > manual > > re-ordering has no effect. > > > Ah, I may have overlooked something in my answer. When you reorder the > controls > only the createEx statements are reordered. The event coding does not change > order. > > You can use an invokeHandler statement in your LText_onClick routine in order > to trigger the CheckBox_onClick. Wonderful. Exactly what I needed, almost. If you are ready for a typical "story" from me, please read on. I suppose this has something to do with the way I've programmed the procedures, but I needed to insert a sleep(1) into the label click procedure to make everything "work" (and by "work" I mean make it functional - I don't think I can leave it this way in a production app). My label click procedure now looks like this: procedure lblchkMyCheck_onClick (integer self, integer event, sequence params) atom myAtom setCheck(chkMyCheck,not(isChecked(chkMyCheck))) sleep( 1) myAtom = invokeHandler(chkMyCheck,w32HClick,{}) end procedure My handler does a lot of things, one of which is to repaint virtually every control on the screen (if that matters), along with present the results of a calculation in a textbox (just one of many controls on the screen). If I pull out the sleep(1) line, then the system does something that seems like there is a bit of code somewhere I've forgotten about (which I generally refer to as a poltereist), because the above code runs twice, the first time with the value of chkMyCheck appropriately changed from what it started out as and the second time with the opposite. That is, the second time it is run with the value of chkMyCheck exactly as chkMyCheck started, thereby putting a result on the screen which is the same as when I started (obviously a bit unproductive), complete with the check mark appearing for an instant and then resetting itself back to how it started. If I insert any CPU halting mechanism at any point in time (a sleep command, or a message box) then the second execution is not done, the check box is appropriately changed and the value is the correct (updated) value. As another hint as to what is going on, if I remove the sleep and message box commands, I can still get it to work, if I click on the label and hold down the left click button for a full second before letting it up. I could understand how holding the left click button down might cause the event to be registered twice, but this is the exact opposite. By clicking quickly and lightly it executes twice. By clicking once (very slowly and heavily) it only executes once. Baffling to me. If that is enough information to trigger somebody's (terrible) memory of something similar I'd love to hear about it. Thanks Mike