News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ComboBox Style - i need your help -

Started by SpSofiane, April 06, 2012, 10:58:25 AM

Previous topic - Next topic

SpSofiane

I want to know if there is possibility to add a style ES_NUMBER to a COMBOBOX control, or a way to limit the edition with Numbers only .
i want to use it as an Edit control.
please help me (I USE MASM32)

jj2007

Post a full code example, and I am sure somebody will help you.

P1

Quote from: SpSofiane on April 06, 2012, 10:58:25 AM
I want to know if there is possibility to add a style ES_NUMBER to a COMBOBOX control, or a way to limit the edition with Numbers only .
i want to use it as an Edit control.
please help me (I USE MASM32)
You will need to monitor the characters sent to the control, and process the ones you want to keep.  The results are ascii, and need to be converted to the numerical format desired, when done.  Or do real time conversion and reject any character that does not convert to format desired.  i.e.  unnecessary leading zeros.

I do not have code for that handy.

Regards,  P1   :8)


dedndave

i have not forgotten you, Sofiane   :P

i have a working numbers-only combobox
i just have one little detail to iron out - then add some comments, and i will post it   :U

MODERATOR:
please move this thread to the campus - thanx

dedndave

#5
ok - here we go

i could probably stand to add a little code to limit the length of the dropdown list
but, here is something to chew on....

EDIT:
removed this attachment - see my next post

dedndave

ok - i made several improvements - cleaned up the code, etc...



fixed it so you can paste numeric strings, too   :P

i am not fond of balloons popping up all the time - lol
i made it so it only pops up if you try to paste a string with non-numeric characters
if you type non-numeric characters, it just ignores them - no balloon
it could easily be modified to balloon on keyboard entry, as well

SpSofiane

COOL   :U :thumbu :dance: :clap:



Yeh !!!   you do it  :wink

dedndave

 :U

i still want to play with some code to limit the drop-down list height

i think i learned as much about tooltips as i did about combo boxes on this one   :P
i wasn't happy with my earlier attempts with tooltips
this time, i used a tracking tooltip
i am much happier with it
you control where and when it pops up

SpSofiane

 :bg
you can be happy with your code, it work so good, thnx for all

SpSofiane

I USED GetComboBoxInfo it work fine :


Quote.const
ES_STYLLE EQU WS_VISIBLE OR WS_CHILD  OR WS_OVERLAPPED OR ES_NUMBER OR ES_NOHIDESEL
USER_ID EQU .....   ;<<<< COMBO CONTROL
..
..
..
.data?
IDcbi       COMBOBOXINFO <?>
hUSER_ID       DWORD ?
..
..
..
.code
...
...
WndProc proc hWin:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

   .if uMsg == WM_INITDIALOG
..
      ...
      invoke GetDlgItem,hWin,USER_ID  ; <<<  GET COMBO WINDOW
      mov hUSER_ID,eax
      mov IDcbi.cbSize,sizeof COMBOBOXINFO
      INVOKE  GetComboBoxInfo,hUSER_ID,addr IDcbi

      invoke SetWindowLong,IDcbi.hwndItem,GWL_STYLE,ES_STYLLE       ; IDcbi.hwndItem = Edit Control Window
...

...
WndProc endp


:dance:
:bdg
im so happy lol

dedndave

lol
nice work   :U

although, you might want to use GetWindowLong to get the current style bits
then OR the ES_STYLE onto it
then use SetWindowLong

surprising that you can set the bit with SetWindowLong, but cannot set it during creation
hmmm...