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

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




------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to