News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

how to draw checkboxs in a combobox

Started by asmcoder, December 27, 2013, 12:04:51 PM

Previous topic - Next topic

asmcoder



hi all,
as you see in the picture, there are 15 checkboxs in a combobox.
when selected multiple items, all the selected index(or text) will show in the text area of the combobox
how to do this? any example?

dedndave

if i was just starting out, i would do it this way....

write a simple program with just a combo box
learn how to place and retrieve text in the edit control
learn how to place text in the drop-down

make another simple program with just check boxes (which are actually a button style)
learn how to put text on them
learn how the mouse events to check/uncheck the boxes send messages to the application

then - write the program with both

asmcoder

hi dedndave,
i think the difficult part is handle WM_DRAWITEM message and create a number of checkboxes

dedndave


dedndave

\Masm32\Examples\dialogs_later\lists
\Masm32\Examples\exampl04\jacts

i would post an example, but the one i have - the combobox us subclassed
that would just make things difficult for a beginner   :P

asmcoder

i used olly reversed the software, found the author did not create checkbox.
he used CopyRect to draw the check/uncheck rectangle
used GetSysColor、SetBkColor、SetTextColor、ExtTextOut、TextOut to handle WM_DRAWITEM

so the problems left are multiple check and set the edit text in combobox, because when clicked a item, the dropdown list will be invisible.


sinsi

Have a look at the latest Event Viewer filter dialog to see why a combobox with checkboxes is a bad idea. You actually have to click off the combobox to close it.
Haven't listboxes got a checkbox style? Much better for the user, an edit and a listbox.

asmcoder

Quote from: sinsi on December 27, 2013, 06:17:50 PM
Have a look at the latest Event Viewer filter dialog to see why a combobox with checkboxes is a bad idea. You actually have to click off the combobox to close it.
Haven't listboxes got a checkbox style? Much better for the user, an edit and a listbox.

hi sinsi,
i just want to improve my coding skill .
i didn't know how to deal with OwnerDraw contorls, i think it's the same to all beginners
when i see the "magic" control, i have a strong desire to figure out how it works.
now i know there are NO real checkboxes , so i think the fake checkboxes in a combobox is not a bad idea
when i figure all things out , i will show my code.

ragdog

Hey

Here is a good Ownerdraw Listbox example with checkboxes
A Listbox is similar to Combobox you must replace the windows Messages

Example
LB_SETITEMDATA to CB_SETITEMDATA
...
..

And Test it

http://www.masmforum.com/archive2012/8260_ODListBox.zip

or look in radasm source addin Manager

asmcoder

Quote from: ragdog on December 27, 2013, 07:50:41 PM
Hey

Here is a good Ownerdraw Listbox example with checkboxes
A Listbox is similar to Combobox you must replace the windows Messages

Example
LB_SETITEMDATA to CB_SETITEMDATA
...
..

And Test it

http://www.masmforum.com/archive2012/8260_ODListBox.zip

or look in radasm source addin Manager

wow, this is exactly what i want. thank you ragdog

ragdog

Exactly what you want?

i have think you want it for a combobox?

Ok is not difficult to change it for a Cbo

asmcoder

Quote from: ragdog on December 27, 2013, 08:26:19 PM
Exactly what you want?

i have think you want it for a combobox?

Ok is not difficult to change it for a Cbo

i mean the method. yes i need to do some changes.

dedndave

the fact that the original program used rectangles to draw checkboxes is ok
but - that's somewhat of an advanced technique

for a beginner, just use buttons with the proper style bits

ragdog

Right dave
But is easy to understand i have a other from Ernest Murphy && NaN
but is better only not easy to understand

asmcoder

hi all,
i have done the job ! :biggrin:
please have a look at my code.