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

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


Thanks for the suggestions.  I updated to Gambas 2.19, but that didn't 
seem to help.  I assume you're referring to the files it creates in the 
.gambas folder inside each project folder?  I've deleted those - 
although I think that what the "Clean up" option does - and re-run the 
program.  The files in .gambas reappear, and I'm still getting the 
behavior where it jumps randomly into the event routine when I call the 
.clear method of the combo-box control:

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()!
FMain.Populate_cbBedList.190: cbBedList.count=1
FMain.Populate_cbBedList.191: $res!BedNum=1

I can try what someone else suggested - setting a flag after populating 
the combo-box to tell me if I'm supposed to be in the event or not - but 
that seems kind of ugly.

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




richard terry wrote:
> On Tuesday 19 January 2010 01:23:19 Bill Richman wrote:
> Bill,
>
> I've intermittently had this problem - I think in my case it was because I'd 
> made changes to the code, saved it, but gambas was running on an old pre-
> compiled version.
>
> I cleaned up the project, deleted all the compiled files, re-compiled and it 
> seemed to fix the problem.
>
> Let me know if that helps for interest.
>
> Regards
>
> Richard
>
>   
>> 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
>>
>>     




More information about the User mailing list