[Gambas-user] Program going off the rails in a way I can't explain. Help?

Bill Richman bill at ...2351...
Tue Jan 19 00:16:09 CET 2010


Well, I upgraded to Gambas 2.19 using the instructions for Ubuntu 
Intrepid found here: http://gambasdoc.org/help/install/ubuntu?view.   
Since "Help/About" now reports 2.19, I have to assume that worked, and 
I'm still getting the same behavior (jumping into the "_click" event 
when running the .clear method of the combo-box control).  Although it 
seems like it runs the _click handler a couple of times for each call to 
.clear, and once during the first usage of the .add method as well: 

FMain.Populate_cbBedList.178: About to run cbBedList.Clear
FMain.cbBedList_Click.169: We're in cbBedList_Click()!
FMain.cbBedList_Click.169: We're in cbBedList_Click()!
FMain.Populate_cbBedList.180: Right after cbBedList.Clear
FMain.Populate_cbBedList.185: $res.Count=9
FMain.Populate_cbBedList.187: $res!BedName=first
FMain.cbBedList_Click.169: We're in cbBedList_Click()!

I can try setting up a flag to kick me out of the _click until after the 
control is populated, as someone else suggested, but that seems pretty 
ugly.  Is there some way I can be sure I'm running 2.19 (in which you 
noted this bug has been fixed) other than the ?/About menu, or is that 
definitive? 

Thanks,

-Bill

Bill Richman - Lincoln, Nebraska
Tilter at windmills, maker of pies in the sky, & curmudgeon
email: bill at ...2350...  web: www.geektrap.com




Benoît Minisini wrote:
>> Benoît Minisini wrote:
>>     
>>>> I've got a really weird problem going on.  I've been working on this
>>>> project for about a month, and today I decided to make some major
>>>> changes to the user interface operates.  I moved some code around and
>>>> delete some code, and now when I run it in the IDE, it randomly jumps
>>>> into the sub that handles the click event for a combo-box control called
>>>> cbBedList_Click().  The routine "Populate_cbBedList()" gets called by
>>>> "Form_Open", and reads values from a database to populate the
>>>> Combo-box.  As far as I can remember, I haven't changed the code for
>>>> this form at all, but seemingly for no reason, when it hits line "178
>>>> cbBedList.Clear" in the Populate sub, it starts executing the code in
>>>> cbBedList_Click!   This generates an error because the cbBedList.index
>>>> value isn't set, since it wasn't actually clicked.  If I remark out the
>>>> contents of the Click event, the Populate routine finishes, although I
>>>> still see the debug statement from line 169.  If I remark out everything
>>>> from 168-173, it still runs fine (although obviously I don't get click
>>>> events handled for the combo-box any longer!).  I'm pulling my hair
>>>> out.  The stack backtrace shows:
>>>>
>>>> FMain.cbBedList_Click.169
>>>> (native code)
>>>> FMain.Populate_cbBedList.178
>>>> FMain.Form_Open.26
>>>>
>>>> Setting a breakpoint at 178 and single-stepping shows exactly what the
>>>> backtrace does; the next line to be executed after 178 is 169!  ANY
>>>> ideas???  Please?
>>>>
>>>> ===
>>>>
>>>>
>>>> 168 PUBLIC SUB cbBedList_Click()
>>>> 169 DEBUG "We're in cbBedList_Click()!"
>>>> 170 '  BedNum = BedList[cbBedList.index + 1]
>>>> 171 '  DrawPlots($db, BedNum)
>>>> 172
>>>> 173 END
>>>> 174
>>>> 175 PUBLIC SUB Populate_cbBedList()
>>>> 176  DIM sql AS String
>>>> 177  'populate the bed selection listbox
>>>> 178  cbBedList.Clear
>>>> 179  sql = "select bedname, bednum from Beds"
>>>> 180 $res = $db.Exec(sql)
>>>> 181  DEBUG "$res.Count=" & $res.Count
>>>> 182  FOR EACH $res
>>>> 183    DEBUG "$res!BedName=" & $res!BedName
>>>> 184    cbBedList.Add($res!BedName)
>>>> 185    DEBUG "cbBedList.count=" & cbBedList.Count
>>>> 186    DEBUG "$res!BedNum=" & $res!BedNum
>>>> 187    BedList[cbBedList.count] = $res!BedNum
>>>> 188  NEXT
>>>> 189 END
>>>>         
>>> Which version of Gambas do you use? With which GUI component? On which
>>> desktop?
>>>       
>> Gambas 2.7, gb.gui, Ubuntu Linux  2.6.27-16-generic, Gnome 2.24.1
>>     
>
> The ComboBox.Clear() method should not raise Click event. This is an old bug 
> that has been fixed since Gambas 2.7. You should upgrade Gambas, or handle 
> that specific case in your code by hand (i.e. by using a global variable as a 
> lock).
>
> Regards,
>
>
>   



More information about the User mailing list