Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combo Box Help Again
#1
I dont know if this is possible but here is wut im trying to do

1. CB_GetCount to see how many items are in the CB
Then is it possible to tell which item you are on?

Like if there are 5 items and you have number 2 selected
Is there a way to tell that number 2 is selected
and this would work in all types of list ranging from 1 - 1000

2. Be able to tell when a combo is on the last item


Please let me know any ideas

Thanks everyone
#2
If the code must be in dialog function, use CB_SelectedItem to get selected item index.
#3
I understand that but is it possible to tell if the CB_SelectedItem is last in the combo?
#4
CB_GetCount returns item count, CB_SelectedItem returns selected item index...
Last item index is count-1.
#5
Ok i have messed with this but im just having alot of trouble :lol:

This will out from 0 - however many i have( in this case 5) it outs 0,1,2,3,4

int loldlg2 = id(3 "Dialog")
int j
for j 0 CB_GetCount(loldlg2)
,out j

I am still having trouble on the CB_SelectedItem tho

Sorry for trouble but thanks
#6
Function comboboxHelp
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ComboBox 0x54230243 0x0 6 10 96 213 ""
;4 Button 0x54032000 0x0 26 32 48 14 "get # of"
;END DIALOG
;DIALOG EDITOR: "" 0x203000D "" "" ""
str controls = "3"
str cb3 = "apples[]bananas[]cherries[]watermelons[]lemons"
if(!ShowDialog("comboboxHelp" &comboboxHelp &controls)) ret ;;MAKE SURE THIS MATCHES THE NAME OF THE FUNCTION

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,int total = CB_GetCount(id(3 hDlg))
,int selected = CB_SelectedItem(id(3 hDlg))
,str text
,CB_GetItemText(id(3 hDlg) selected &text)
,str display = "Count: "
,display + total
,display + "[]Selected #: "
,display + selected
,display+ "[]Selected Text: "
,display + text
,display +"[]On Last item?: "
,if (selected + 1 = total)
,,display + "Yes"
,else
,,display + "No"
,mes display
,
,case IDOK
,case IDCANCEL
ret 1
#7
Bro thank you so much

This is perfect


Forum Jump:


Users browsing this thread: 1 Guest(s)