1. Enhanced IDE control ordering
- Posted by Mike777 <anon4321 at gmail?c?m> Jan 26, 2008
- 635 views
I have a set of two controls, a label and a checkbox. For now, assume the two controls are not related by code in any way. I want to "click" the label and have it function as if it were a click of the checkbox. No problem, using code similar to: myLabel_onClick(.....) myCheckbox_onClick(.....) 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. If I go into the exw file and manually place the myCheckbox_onClick code before the myLabel_onClick code, it works fine. 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. The language at the top of the Control Order window says: Use this window to establish the order of controls by window for the output EX(W) file. Order is order controls are on Window OR the last reordering by user. Changing order does not alter the order of controls in Project View. Well, how do I tell the computer that I really, really want it to be "the last reordering by user" and not "order controls are on Window"? I know a workaround is to put a routine in the General section and call it from each of the two controls, but that would make my General section unmanageable by the time I got done. Thanks Mike
2. Re: Enhanced IDE control ordering
- Posted by Judith Evans <camping at cc?wb.ne?> Jan 26, 2008
- 610 views
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. This works without changing anything in reorder controls. include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) constant LText3 = createEx( LText, "LText3", Window1, 48, 24, 148, 20, w32or_all({SS_NOTIFY}), 0 ) constant CheckBox2 = createEx( CheckBox, "CheckBox2", Window1, 76, 60, 148, 20, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- procedure LText3_onClick (integer self, integer event, sequence params)--params is () setCheck(CheckBox2, w32True) end procedure setHandler( LText3, w32HClick, routine_id("LText3_onClick")) -------------------------------------------------------------------------------- procedure CheckBox2_onClick (integer self, integer event, sequence params)--params is () if not isChecked(CheckBox2) then VOID=message_box("is not checked now","",0) end if end procedure setHandler( CheckBox2, w32HClick, routine_id("CheckBox2_onClick")) --------------------------------------------------------- WinMain( Window1,Normal ) > 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. I tested the above project and used reordering such that label was after the checkbox and ran the project. Looking at the exw the label is now after the checkbox. > Thanks > > Mike judith
3. Re: Enhanced IDE control ordering
- Posted by Judith Evans <camping at cc?wb.ne?> Jan 26, 2008
- 620 views
> 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. > Mike judith
4. Re: Enhanced IDE control ordering
- Posted by Mike777 <anon4321 at ??ail.com> Jan 27, 2008
- 584 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
5. Re: Enhanced IDE control ordering
- Posted by David Stevenson <ff16 at mts??et> Jan 27, 2008
- 601 views
Mike777 wrote: SNIP > > 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 >SNIP Could it be your mouse is malfunctioning? Most annoying if your mouse doesn't act exactly as expected. Just an idle thought.
6. Re: Enhanced IDE control ordering
- Posted by Mike777 <anon4321 at gm?il.?om> Jan 27, 2008
- 670 views
David Stevenson wrote: > > Mike777 wrote: > SNIP > > > > 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 > >SNIP > > Could it be your mouse is malfunctioning? > Most annoying if your mouse doesn't act exactly as expected. > Just an idle thought. At this point, anything is possible. I just checked and it appears to be working just like the other two I just plugged in, as well as testing with the mousepad on the laptop (my regular mouse is a USB mouse). I thought it might be related to the fact that I have windows explorer set so that single clicks operate to open a file (normally reserved for double clicks), but setting that back to requiring double clicks to open a file appears to have no impact. Thanks for the suggestion, at least it helped me rule out another couple of possibilities. Mike