Win32Lib bug...maybe...I think...
- Posted by Jonas and Kristin Temple <jktemple at YHTI.NET> Feb 03, 2001
- 427 views
------=_NextPart_000_0020_01C08DEA.26652380 charset="iso-8859-1" I have been really struggling with this one and thought it was in my = code until I get the registered version of Euphoria and it showed me the = error was in a routine in Win32Lib. Here's the sequence of events to = re-produce the bug: - Run the code I've included. - There are two buttons, one labeled "Test, No Clear" and the other = "Test, with Clear". The difference is whether or not the eraseItems = routine is used to clear the list view control in the subsequence = window. - With no items in the list view in the main window, click either test = button and drag the window around the screen. No problem. - Close the second window, click the add item to add one or more items = to the main list view control. - Now click "Test, No Clear". Drag the second window around the screen. = No problem. =20 - Close the second window, click "Test, With Clear". Drag the second = window around and eventually the program wil crash in the = fDoLVN_GETDISPINFO routine. The crash usually happens when the window = is moved so some portion of the list view in the main window becomes = visible. Again, I'm not certain if I'm doing something wrong but the bug ONLY = happens when you call eraseItems for the list view control in the second = window AND items are in the list view control in the main window. How = about that for obscure? I'm working on a database order entry = application and using list views are pretty central in my design. This = is definitely keeping me from proceeding. Since I'm on the subject, here's what I'd like to see added/changed in = list view controls: - A removeColumns() routine to remove all the columns in a list view. = There are some circustances where it would be nice to rebuild the = columns. - Ability to specify where to add the item using addLVItem routine. The = function currently uses 0 as the parameter of where to add the item. If = you are adding items from a database the first one you added is always = the last one in the list. It would be nice to have more control over = that. I have changed this myself in Win32Lib but I want to stick with = the official version. - I don't have particulars about this one, but there seems to be a = problem when retrieving a list view item and the user has clicked a = column header to change the sort order of the items. I don't think the = internal sequence for the list view is being resorted. Sorry I can't = provide more detail. It may seem like I'm focusing in on list view controls but I have been = using them so much I have found these limitations. I would like to say = that I really appreciate all the work the different people have been = doing to Win32Lib. I am grateful for their efforts. Jonas Here's the code: include Win32Lib.ew=20 without warning global atom MainWin_x, MainWin_y, MainWin_cx, MainWin_cy, MaintWin_cx, MaintWin_cy -- Starting values for window size/position=20 MainWin_x =3D 100 MainWin_y =3D 100 MainWin_cx =3D 550 MainWin_cy =3D 450 MaintWin_cx =3D 550 MaintWin_cy =3D 300=20 global constant MainWin =3D create( Window, "Job History", 0, MainWin_x, MainWin_y, = MainWin_cx, MainWin_cy, 0) -- Constants for main window global constant TestNo =3D create( PushButton, "Test, No Clear", MainWin, 5, 5, 90, 30, = 0), TestYes =3D create( PushButton, "Test, With Clear", MainWin, 5, 35, 90, = 30, 0), AddItem =3D create( PushButton, "Add Item", MainWin, 5, 65, 90, 30, 0), ClearItem =3D create( PushButton, "Clear Item", MainWin, 5, 95, 90, 30, = 0), JobList =3D createEx( ListView, {"Job Name", "Job Number", "Customer", "Status"}, MainWin, 100, 25, MainWin_cx - 50, MainWin_cy - 50, LVS_REPORT, LVS_EX_FULLROWSELECT) -- Window MaintWin=20 global constant MaintWin =3D create( Window, "Job History View", = MainWin, 1, 1, 800, 500, WS_DLGFRAME) global constant Static1 =3D create( LText, "Job Number:", MaintWin, 8, = 12, 76, 20, 0 ) global constant JobNumberEdit =3D create( EditText, "", MaintWin, 88, = 12, 88, 20, 0 ) global constant Static2 =3D create( LText, "Job Name:", MaintWin, 8, 44, = 76, 20, 0 ) global constant JobNameEdit =3D create( EditText, "", MaintWin, 88, 44, = 212, 20, 0 ) global constant Static3 =3D create( LText, "Contact:", MaintWin, 8, 76, = 76, 20, 0 ) global constant JobContactEdit =3D create( EditText, "", MaintWin, 88, = 76, 212, 20, 0 ) global constant Static4 =3D create( LText, "Address:", MaintWin, 8, 108, = 76, 20, 0 ) global constant JobAddressEdit =3D create( EditText, "", MaintWin, 88, = 108, 212, 20, 0 ) global constant Static5 =3D create( LText, "City:", MaintWin, 8, 140, = 76, 20, 0 ) global constant JobCityEdit =3D create( EditText, "", MaintWin, 88, 140, = 212, 20, 0 ) global constant Static6 =3D create( LText, "State:", MaintWin, 8, 172, = 76, 20, 0 ) global constant JobStateEdit =3D create( EditText, "", MaintWin, 88, = 172, 48, 20, 0 ) global constant Static7 =3D create( LText, "Zip:", MaintWin, 144, 172, = 36, 20, 0 ) global constant JobZipEdit =3D create( EditText, "", MaintWin, 184, 172, = 116, 20, 0 ) global constant Static8 =3D create( LText, "Phone:", MaintWin, 8, 204, = 76, 20, 0 ) global constant JobPhoneEdit =3D create( EditText, "", MaintWin, 88, = 204, 150, 20, 0 ) global constant Static9 =3D create( LText, "Estimated $ for Quoted = Work:", MaintWin, 324, 44, 150, 20, 0 ) global constant Static10 =3D create( LText, "Actual $ for Complete = Work:", MaintWin, 324, 76, 150, 20, 0 ) global constant JobEstimateEdit =3D create( EditText, "", MaintWin, 476, = 44, 150, 20, 0 ) global constant JobActualEdit =3D create( EditText, "", MaintWin, 476, = 76, 150, 20, 0 ) global constant JobStatusGroup =3D create( Group, "Job Status:", = MaintWin, 324, 108, 200, 112, 0 ) global constant StatusQuote =3D create( Radio, "Quoted", MaintWin, 328, = 124, 150, 20, 0 ) global constant StatusRejected =3D create( Radio, "Rejected", MaintWin, = 328, 156, 150, 20, 0 ) global constant StatusComplete =3D create( Radio, "Completed", MaintWin, = 328, 188, 150, 20, 0 ) global constant JobDetailList =3D create( ListView,=20 {"Description","Line","Quantity","Price Per Unit", "Estimated Amount","Actual Amount","Estimator", "Installer","Line Status","Sched Install Date","Actual Install Date"},=20 MaintWin, 8, 232,736, 180, LVS_REPORT+LVS_SHOWSELALWAYS) global constant OkayButton =3D create( PushButton, "Okay", MaintWin, = 648, 20, 90, 30, 0 ) global constant CancelButton =3D create( PushButton, "Cancel", MaintWin, = 648, 60, 90, 30, 0 ) global constant AddItemButton =3D create( PushButton, "Add Item", = MaintWin, 536, 108, 90, 30, 0 ) global constant EditItemButton =3D create( PushButton, "Edit Item", = MaintWin, 536, 144, 90, 30, 0 ) global constant DeleteItemButton =3D create( PushButton, "Delete Item", = MaintWin, 536, 180, 90, 30, 0 ) procedure MainWin_onResize(atom style, atom new_cx, atom new_cy)=20 if style !=3D SIZE_MINIMIZED then=20 -- Store new window size co-ordinates MainWin_cx =3D new_cx MainWin_cy =3D new_cy=20 setSize(JobList, MainWin_cx - 100, MainWin_cy - 100) end if end procedure onResize[ MainWin ] =3D routine_id("MainWin_onResize") -- procedure TestNo_onClick()=20 -- Display the job maintenance window openWindow(MaintWin, Modal)=20 end procedure onClick[ TestNo ] =3D routine_id("TestNo_onClick") procedure TestYes_onClick()=20 eraseItems(JobDetailList) -- Display the job maintenance window openWindow(MaintWin, Modal)=20 end procedure onClick[ TestYes ] =3D routine_id("TestYes_onClick") procedure AddItem_onClick()=20 atom lv_item lv_item =3D addLVItem(JobList, 0, {"1","1", "1","Quoted"}) end procedure onClick[ AddItem ] =3D routine_id("AddItem_onClick") procedure ClearItem_onClick()=20 eraseItems(JobList) end procedure onClick[ ClearItem ] =3D routine_id("ClearItem_onClick") WinMain(MainWin, Maximize) ------=_NextPart_000_0020_01C08DEA.26652380 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type> <META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT size=3D2>I have been really struggling with this one and = thought it was=20 in my code until I get the registered version of Euphoria and it showed = me the=20 error was in a routine in Win32Lib. Here's the sequence of events = to=20 re-produce the bug:</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>- Run the code I've included.</FONT></DIV> <DIV><FONT size=3D2>- There are two buttons, one labeled "Test, No=20 Clear" and the other "Test, with Clear". The = difference is=20 whether or not the eraseItems routine is used to clear the list view = control in=20 the subsequence window.</FONT></DIV> <DIV><FONT size=3D2>- With no items in the list view in the main window, = click=20 either test button and drag the window around the screen. No=20 problem.</FONT></DIV> <DIV><FONT size=3D2>- Close the second window, click the add item to add = one or=20 more items to the main list view control.</FONT></DIV> <DIV><FONT size=3D2>- Now click "Test, No Clear". Drag = the second=20 window around the screen. No problem. </FONT></DIV> <DIV><FONT size=3D2>- Close the second window, click "Test, With=20 Clear". Drag the second window around and eventually the = program wil=20 crash in the fDoLVN_GETDISPINFO routine. The crash usually happens = when=20 the window is moved so some portion of the list view in the main window = becomes=20 visible.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>Again, I'm not certain if I'm doing something wrong = but the=20 bug ONLY happens when you call eraseItems for the list view control in = the=20 second window AND items are in the list view control in the main = window. =20 How about that for obscure? I'm working on a database order entry=20 application and using list views are pretty central in my design. = This is=20 definitely keeping me from proceeding.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Since I'm on the subject, here's what I'd like to = see=20 added/changed in list view controls:</FONT></DIV> <DIV><FONT size=3D2>- A removeColumns() routine to remove all the = columns in a=20 list view. There are some circustances where it would be nice to = rebuild=20 the columns.</FONT></DIV> <DIV><FONT size=3D2>- Ability to specify where to add the item using = addLVItem=20 routine. The function currently uses 0 as the parameter of where = to add=20 the item. If you are adding items from a database the first one = you added=20 is always the last one in the list. It would be nice to have more = control=20 over that. I have changed this myself in Win32Lib but I want to = stick with=20 the official version.</FONT></DIV> <DIV><FONT size=3D2>- I don't have particulars about this one, but there = seems to=20 be a problem when retrieving a list view item and the user has clicked a = column=20 header to change the sort order of the items. I don't think the = internal=20 sequence for the list view is being resorted. Sorry I can't = provide more=20 detail.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>It may seem like I'm focusing in on list view = controls but I=20 have been using them so much I have found these limitations. I = would like=20 to say that I really appreciate all the work the different people have = been=20 doing to Win32Lib. I am grateful for their efforts.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Jonas</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>Here's the code:</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2> <P>include Win32Lib.ew </P> <P>without warning</P> <P>global atom MainWin_x, MainWin_y, MainWin_cx, MainWin_cy,</P> <P>MaintWin_cx, MaintWin_cy</P> <P>-- Starting values for window size/position </P> <P>MainWin_x =3D 100</P> <P>MainWin_y =3D 100</P> <P>MainWin_cx =3D 550</P> <P>MainWin_cy =3D 450</P> <P>MaintWin_cx =3D 550</P> <P>MaintWin_cy =3D 300 </P> <P>global constant</P> <P>MainWin =3D create( Window, "Job History", 0, MainWin_x, = MainWin_y,=20 MainWin_cx, MainWin_cy, 0)</P> <P>-- Constants for main window</P> <P>global constant</P> <P>TestNo =3D create( PushButton, "Test, No Clear", MainWin, = 5, 5, 90,=20 30, 0),</P> <P>TestYes =3D create( PushButton, "Test, With Clear", = MainWin, 5, 35,=20 90, 30, 0),</P> <P>AddItem =3D create( PushButton, "Add Item", MainWin, 5, 65, = 90, 30,=20 0),</P> <P>ClearItem =3D create( PushButton, "Clear Item", MainWin, 5, = 95, 90,=20 30, 0),</P> <P>JobList =3D createEx( ListView, {"Job Name", "Job = Number",=20 "Customer",</P> <P>"Status"},</P> <P>MainWin, 100, 25, MainWin_cx - 50, MainWin_cy - 50, LVS_REPORT,</P> <P>LVS_EX_FULLROWSELECT)</P> 12, 88, 20, 0 )</P> <P>global constant Static2 =3D create( LText, "Job Name:", = MaintWin, 8,=20 44, 76, 20, 0 )</P> <P>global constant JobNameEdit =3D create( EditText, "", = MaintWin, 88,=20 44, 212, 20, 0 )</P> <P>global constant Static3 =3D create( LText, "Contact:", = MaintWin, 8,=20 76, 76, 20, 0 )</P> <P>global constant JobContactEdit =3D create( EditText, "", = MaintWin,=20 88, 76, 212, 20, 0 )</P> <P>global constant Static4 =3D create( LText, "Address:", = MaintWin, 8,=20 108, 76, 20, 0 )</P> <P>global constant JobAddressEdit =3D create( EditText, "", = MaintWin,=20 88, 108, 212, 20, 0 )</P> <P>global constant Static5 =3D create( LText, "City:", = MaintWin, 8, 140,=20 76, 20, 0 )</P> <P>global constant JobCityEdit =3D create( EditText, "", = MaintWin, 88,=20 140, 212, 20, 0 )</P> <P>global constant Static6 =3D create( LText, "State:", = MaintWin, 8,=20 172, 76, 20, 0 )</P> <P>global constant JobStateEdit =3D create( EditText, "", = MaintWin, 88,=20 172, 48, 20, 0 )</P> <P>global constant Static7 =3D create( LText, "Zip:", = MaintWin, 144,=20 172, 36, 20, 0 )</P> <P>global constant JobZipEdit =3D create( EditText, "", = MaintWin, 184,=20 172, 116, 20, 0 )</P> <P>global constant Static8 =3D create( LText, "Phone:", = MaintWin, 8,=20 204, 76, 20, 0 )</P> <P>global constant JobPhoneEdit =3D create( EditText, "", = MaintWin, 88,=20 204, 150, 20, 0 )</P> <P>global constant Static9 =3D create( LText, "Estimated $ for = Quoted=20 Work:", MaintWin, 324, 44, 150, 20, 0 )</P> <P>global constant Static10 =3D create( LText, "Actual $ for = Complete=20 Work:", MaintWin, 324, 76, 150, 20, 0 )</P> <P>global constant JobEstimateEdit =3D create( EditText, "", = MaintWin,=20 476, 44, 150, 20, 0 )</P> <P>global constant JobActualEdit =3D create( EditText, "", = MaintWin,=20 476, 76, 150, 20, 0 )</P> <P>global constant JobStatusGroup =3D create( Group, "Job = Status:",=20 MaintWin, 324, 108, 200, 112, 0 )</P> <P>global constant StatusQuote =3D create( Radio, "Quoted", = MaintWin,=20 328, 124, 150, 20, 0 )</P> <P>global constant StatusRejected =3D create( Radio, = "Rejected",=20 MaintWin, 328, 156, 150, 20, 0 )</P> <P>global constant StatusComplete =3D create( Radio, = "Completed",=20 MaintWin, 328, 188, 150, 20, 0 )</P> <P>global constant JobDetailList =3D create( ListView, </P> rice=20 Per Unit",</P> <P>"Estimated Amount","Actual=20 Amount","Estimator",</P> <P>"Installer","Line Status","Sched Install=20 Date","Actual Install Date"}, </P> <P>MaintWin, 8, 232,736, 180, LVS_REPORT+LVS_SHOWSELALWAYS)</P> <P>global constant OkayButton =3D create( PushButton, "Okay", = MaintWin,=20 648, 20, 90, 30, 0 )</P> <P>global constant CancelButton =3D create( PushButton, = "Cancel",=20 MaintWin, 648, 60, 90, 30, 0 )</P> <P>global constant AddItemButton =3D create( PushButton, "Add = Item",=20 MaintWin, 536, 108, 90, 30, 0 )</P> <P>global constant EditItemButton =3D create( PushButton, "Edit = Item",=20 MaintWin, 536, 144, 90, 30, 0 )</P> <P>global constant DeleteItemButton =3D create( PushButton, "Delete = Item", MaintWin, 536, 180, 90, 30, 0 )</P> <P></P> <P>procedure MainWin_onResize(atom style, atom new_cx, atom new_cy) </P> <P>if style !=3D SIZE_MINIMIZED then </P> <P>-- Store new window size co-ordinates</P> <P>MainWin_cx =3D new_cx</P> <P>MainWin_cy =3D new_cy </P> <P>setSize(JobList, MainWin_cx - 100, MainWin_cy - 100)</P> <P>end if</P> <P>end procedure</P> <P>onResize[ MainWin ] =3D routine_id("MainWin_onResize")</P> <P>--</P> <P></P> <P>procedure TestNo_onClick() </P> <P>-- Display the job maintenance window</P> <P>openWindow(MaintWin, Modal) </P> <P>end procedure</P> <P>onClick[ TestNo ] =3D routine_id("TestNo_onClick")</P> <P>procedure TestYes_onClick() </P> <P>eraseItems(JobDetailList)</P> <P>-- Display the job maintenance window</P> <P>openWindow(MaintWin, Modal) </P> <P>end procedure</P> <P>onClick[ TestYes ] =3D routine_id("TestYes_onClick")</P> <P></P> <P>procedure AddItem_onClick() </P> <P>atom lv_item</P> <P>lv_item =3D addLVItem(JobList, 0, {"1","1",</P> <P>"1","Quoted"})</P> <P>end procedure</P> <P>onClick[ AddItem ] =3D routine_id("AddItem_onClick")</P> <P></P> <P>procedure ClearItem_onClick() </P> <P>eraseItems(JobList)</P> <P>end procedure</P> <P>onClick[ ClearItem ] =3D = routine_id("ClearItem_onClick")</P> <P>WinMain(MainWin, Maximize)</P> <P></FONT> </P></DIV> <DIV> </DIV> ------=_NextPart_000_0020_01C08DEA.26652380--