Re: Upcoming win32lib v0.70.4a
- Posted by CChris <christian.cuvier at agri?ul?ure.gouv.fr> Apr 24, 2008
- 597 views
Mike777 wrote: > > Mike777 wrote: > > > > CChris wrote: > > > > > > * Mike777 (or Judith, or anyone else who chanced upon the issue): I need > > > some > > > evidence of what is going on when recreating a control and something goes > > > wrong. > > > Do you have any? > > > > Not too much. Here's a description. I have a main window with two combo > > boxes > > used to select client and project. Once selected, there is a command button > > which reads those two combo boxes and from the combination, understands > > where > > to find a text file that has a whole slew of newUIObj commands. I use that > > text file to build a series of controls. All works as expected. The very > > first > > control that is built, by convention is a tab control. All other controls > > are > > descendants of that tab control. > > > > I have a menu item: File|New which is intended to essentially start the > > program > > over. > > > > It executes the following: > > > > setVisible({cboBox1,lblcboBox1,cboBox2,lblcboBox2,cmdStartProgram},w32True) > > destroy(getNameId("tabControlMain")) > > > > When I execute the above, it works fine. > > > > However, when I re-execute the command button (pointing to the same text > > file) > > I get an error message with the following: > > > > Error code 459 > > create():Invalid parent id. > > > > W32Lib v0.70.4 15-Mar-2008 > > > > Press enter .... > > > > So I comment out the above two lines and replace them with: > > > > shellExecute("open","RerunMyProgram.bat",SW_SHOWNORMAL) > > abort(1) > > > > Where ReRunMyProgram has the following in it: > > > > START MYPROGRAM.Exe && EXIT > > > > Which, does what I want in that I now have my program opened, memory cleared > > and my selection boxes again available. If I set the combos and select the > > command > > button, the controls are again built without a problem. > > > > I did some debugging and found that on the rebuild, I successfully place the > > main tab control, and a series of tab items (pages). It is only when trying > > to add the first control to a tab item does the program abort with an > > invalid > > parent message. > > > > I tried a number of controls (combos, labels, text boxes) they all abort. > > So > > there is something about establishing the tab item control the second time > > around > > which doesn't allow it to be referenced as a parent. > > > > While I haven't 100% confirmed this, here are 3 lines which if they are the > > only controls built should give an error when the combo is built: > > > > Control:"TabControl,Main Tab > > Control,tabMainControl,0,0,1200,950,parent=Window1" > > > > Control:"TabItem,Client > > Info,tbiClientInfo,parent=tabMainControl,initialfocus=1" > > > > Control:"Combo,cboFirst,cboFirst,100,40,60,140,parent=tbiClientInfo > > Still testing at this end. I was able to strip out all but the three lines > above and, of course (grumble, grumble) it works fine. > > So, there must be something in the remaining 1000 lines or so which is > effectively > poisoning the ability of the tab page to accept the role of parent. > > Maybe I'll excise 50 at a time until I can find the culprit. > > Mike When controls are recreated, they have ids that bear hardly any relations to what they were. As a result, I assume you store the ids into integers. I wonder whether marking the ids as invalid whle the controls are destroyed (for instance, assigning them -1) wouldn't help. Judith uses this technique in IDE. Also, I'd appreciate some ex.errs from your tests. Please email them to oedoc hat free doubt fr, if at all possible. One more thing: does (re)creating the controls using newUIObj() or plain createEx() statements make any difference? It shouldn't but the lib shouldn't crash either... CChris