Author |
Topic: Combobox problem (Read 293 times) |
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Combobox problem
« Thread started on: Sep 27th, 2015, 12:25am » |
|
I have a combobox that works properly the first time it is used. But, when I re-fill the associated array and reload with new items, if I select the item in the same position as chosen the first time, nothing happens - it does not branch to the associated paragraph. Is there something I need to do to 'refresh' the combobox?
r.m.
Code:
WindowWidth = DisplayWidth : WindowHeight = DisplayHeight
groupbox #itemSell.gb1, "",15,5,600,100
STATICTEXT #itemSell.stDept, "Department", 30, 20, 90, 20
textBOX #itemSell.tbDept, 30,50,130,30
STATICTEXT #itemSell.stCtgy, "Category", 200, 20, 90, 20
textBOX #itemSell.tbCtgy, 200,50,130,30
STATICTEXT #itemSell.stType, " Type ", 370, 20, 60, 20
textBOX #itemSell.tbType, 370,50,130,30
BUTTON #itemSell.btnClr, "New", [itemSellLoop], UL, 540, 30, 50,50
STATICTEXT #itemSell.stDesc, "Description", 50, 160, 90, 20
comboBOX #itemSell.cbDesc, desc$(,[itemSellFile],160,160,200,50
STATICTEXT #itemSell.stUnit, "Units", 50, 210, 90, 20
TEXTBOX #itemSell.tbUnit, 160,210,90,25 : Stylebits #itemSell.tbUnit, _ES_READONLY, 0, 0, 0
STATICTEXT #itemSell.stPrice, "Price", 50, 260, 50, 20
TEXTBOX #itemSell.tbPrice, 160,260,90,25 : Stylebits #itemSell.tbPrice, _ES_READONLY, 0, 0, 0
STATICTEXT #itemSell.stQty, "Quanity", 50, 310, 60, 20
TEXTBOX #itemSell.tbQty, 160,308,90,27 : Stylebits #itemSell.tbQty, _ES_NUMBER, 0, 0, 0
BUTTON #itemSell.btnAdd, " Item Amount ", [itemSellGet], UL, 20, 360
TEXTBOX #itemSell.tbAmt, 160, 360, 90, 25 : Stylebits #itemSell.tbAmt, _ES_READONLY, 0, 0, 0
BUTTON #itemSell.btnAdd, " Order Amount ", [itemSellAccept], UL, 15, 410
textbox #itemSell.tbOrdTot, 160, 410, 90, 25 : Stylebits #itemSell.tbAmt, _ES_READONLY, 0, 0, 0
BUTTON #itemSell.btnChkOut, "Go To Check Out ", [itemSellChkOut], UL, 160, 510
open sellReturnTitle$ for dialog as #itemSell
#itemSell, "trapclose [itemSellExit]"
#itemSell, "font 12"
call cbLimit hwnd(#itemSell.cbDesc),20
x = 10 'val(onHand$(sellIndx))
y = hWnd(#itemSell)
z = hWnd(#itemSell.tbQty)
call spinner x,y,z
redim sellFile$(19) : redim sellRec$(19) : redim desc$(19)
orderFiles = 0 ' count of files in order
orderTot = 0 ' cost of items in order
[itemSellLoop]
gosub [comboThree]
redim desc$(19)
#itemSell.tbDept, word$(path3$,6,"\")
#itemSell.tbCtgy, word$(path3$,7,"\")
#itemSell.tbType, word$(path3$,8,"\")
files path3$, info$(
fc = val(info$(0, 0)) ' file level
for cf = 1 to fc
x$ = info$(cf,0)
desc$(cf) = left$(x$,len(x$)-4)
next
#itemSell.cbDesc, "reload"
#itemSell.cbDesc, "!Items List"
#itemSell.tbQty, "!setfocus"
wait
[itemSellFile]
#itemSell.cbDesc,"selectionindex? sellIndx" 'chosen file/item
fileName$ = path3$ + info$(sellIndx,0)
notice fileName$
open fileName$ for input as #itemFile
line input #itemFile , itemRec$
close #itemFile
notice itemRec$
#itemSell.tbUnit,word$(itemRec$,2,"|")
#itemSell.tbPrice,using("##.##",val(word$(itemRec$,3,"|")))
orderFiles = orderFiles + 1 'count of files used in this order
sellFile$(orderFiles) = fileName$
sellRec$(orderFiles) = itemRec$
wait
|
|
Logged
|
|
|
|
RobM
Junior Member
member is offline
Posts: 91
|
|
Re: Combobox problem
« Reply #1 on: Sep 27th, 2015, 04:13am » |
|
Add this right after your reload command.
Code:#itemSell.cbDesc, "selectindex 0"
|
|
Logged
|
|
|
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Re: Combobox problem
« Reply #2 on: Sep 27th, 2015, 9:47pm » |
|
Thanks, RobM I think I knew about setting the index to 0, but I had forgotten it. BTW, the same instruction also works to make singleclickselect consistent. r.m.
|
|
Logged
|
|
|
|
|