PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

ComboBox Functions ?

How to use the combobox control ?
I'm trying but without success, using a similar code than for the listbox but...

Small diference with the other control is that the default value set in the visual form builder is not displayed on the pocket pc.

func ComboBoxAddItem(combobox$, editbox$)
text$ = GetText(editbox$);
SetItem(editbox$,0,text$);
where$ = SendMessage(combobox$, CB_GETCURSEL, where$, 0);
SendMessage(combobox$, CB_ADDSTRING, where$, text$);
Return(True);
end;

func ComboBoxDelItem(combobox$)
where$ = SendMessage(combobox$, CB_GETCURSEL, where$, 0);
SendMessage(combobox$, CB_DELETESTRING, where$, 0);
Return(True);
end;

func FORM100Proc (hWnd$, Msg$, wParam$, lParam$)
ok$ = true;
case(Msg$)
WM_COMMAND:
wmId$ = LOWORD(wParam$);
wmEvent$ = HIWORD(wParam$);
case(wmId$)
1001: // Exit
PostMessage(hWnd$, WM_CLOSE, 0, 0);
return(false);
103: // Add
ComboBoxAddItem(COMBOBOX101$,EDIT102$);
104: // Del
ComboBoxDelItem(COMBOBOX101$);
105: // Update
//ComboBoxUpdateItem(COMBOBOX101$,EDIT102$);
106: // Clear
//ComboBoxClear(COMBOBOX101$);
107: // Test
//ComboBoxTest(COMBOBOX101$);

end;
end;
return (ok$);
end;
Thanks to our good friend Eric Pankoke who was able to help me solve this problem too. :)

One of the keys to the combo is that the height parameter has to be a fairly large number (100 always seems to work good for me). I don't know if it's clearly explained in MS documentation anywhere, but I think what's happening is that the height is a combination of the combo height when it's closed plus the height of the drop down when the combo is open.

c$ = NewControl(700, "COMBOBOX", 0, "", CBS_DROPDOWNLIST | WS_VSCROLL, form$, 10, 10, 150, 100);


Btw, I have fixed the visual form builder code generator to make the size 100 by default for comboboxes.

Regards,
Kornalius
Thanks it works now !

In fact the way the combobox is displayed in the Visual Builder is in it fully extended state.
So it's in the Visual Builder that you define the maxium size for the combobox, this is a great behaviour.
Perfect if you add the default height of 100, but the reason why i make mistake here is that the small triangle at ritgh is vertically centered on the combobox in the visual builder so it's like if it's a very big one for big characters :-)

Thanks a lot, I completed the ComboBox_lib.ppl :-)

I have not yet tested including the file as a include lib in ppl, but it work by copy paste in my apps.

Regards,
Attachments:
PPL_Libs.zip (2 KB)