News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Flat buttons

Started by ragdog, December 08, 2013, 04:41:17 AM

Previous topic - Next topic

ragdog

Hi @all

I search an example about flat buttons like this



The flat button is not this problem but how works the pushed button in the right side from the screenshot?

Regards,

ragdog

Ok i have found a simply solution  :t

BS_AUTORADIOBUTTON | BS_PUSHLIKE

Adamanteus

Where you found in - MSDN, not says this ?

jj2007

BS_PUSHLIKE is even mentioned in the old Win32.hlp
But I must admit it's the first time I saw it - nice find :t

Adamanteus

 ... and I could remark, that with comctl32.dll common controls - that's do absolutely no effect  :redface:

ragdog

@Adamanteus

Yes is correct i have add it but i dont works with manifest

but here is it
http://www.masmforum.com/archive2012/10350_Button_Example.zip

I have make my own solution,I have make owner draw  buttons and now have this same effect ;)

If my project finish can i send a example.

Regards

ragdog

Hi all

I have make my Buttons ownerdraw

I subclass the buttons for handle the buttons for WM_MOUSEMOVE,WM_CAPTURECHANGED etc for Mouse over ,Click and up
and it change the color in the WM_DRAWITEM.

Ok this works fine without any problems.
But now i wish Ownerdraw the radio buttons with Mouse over is Checked and unchecked


It works only with a one radion button
because i need the handle of the other radio buttons.

I think it must works with this SendMessages or have your an example or idea?


.elseif uMsg==WM_LBUTTONUP
invoke SendMessage,hWnd,BM_GETCHECK,0,0
    .if eax==BST_CHECKED
        invoke SendMessage,hWnd,BM_SETCHECK,BST_UNCHECKED,0
          mov BTChecked,0
invoke SetDlgItemText,hMain,1004,CTEXT ("uncheck")
       .else
           invoke  SendMessage,hWnd,BM_SETCHECK,BST_CHECKED,0
           mov BTChecked,1
   invoke SetDlgItemText,hMain,1004,CTEXT ("check")
    .endif
invoke  InvalidateRect,hWnd,0,TRUE


Regards,
raggy

hutch--

old trick, use a FLAT button style but put a border around it.

Tedd

Quote from: ragdog on December 17, 2013, 04:33:47 AM
It works only with a one radion button
because i need the handle of the other radio buttons.

If you want the same code to work for each control, you will need to check what the notification actually is, and use the control's handle/ID given to you as part of the notification, i.e. in wparam and lparam.
If you only use hard-coded values for one of the controls, then obviously only that control will work.
Potato2

ragdog

Ok thanks for trying help me but i have found a other solution without a radio button

I draw my buttons on WM_DRAWITEM and set the styles for the draw colors on subclass with GWL_USERDATA
If i wish a Pushlike button must i reset all buttons and set a new style on the current button
:lol:



.elseif uMsg==WM_LBUTTONUP
;-- reset all style of buttons
mov    ecx,1001
    .while   ecx <= 1004
push      ecx
invoke    GetDlgItem,hMain,ecx
mov       ebx,eax
        invoke    GetWindowLong,eax,GWL_STYLE
    .if   eax & BS_OWNERDRAW
          invoke GetWindowLong,ebx,GWL_USERDATA
          and     eax, not 2
          invoke SetWindowLong,ebx,GWL_USERDATA,eax
          invoke    InvalidateRect,ebx,0,TRUE
    .endif
    pop    ecx
inc    ecx
    .endw

;-- Set new style of current button
invoke   GetWindowLong,hWnd,GWL_USERDATA
or        eax,2
invoke   SetWindowLong,hWnd,GWL_USERDATA,eax
invoke    InvalidateRect,hWnd,0,TRUE


Ok is a tricky way but it works perfect

I must clear my code then I can send it.
And i hope any has a better solution.

Thanks and greets,

ragdog

Hi

Now have i time to make my project finish

But i have a little question to check the states of buttons

What ist better and faster to check the states?

to set states to GWL_USERDATA

invoke   GetWindowLong,hWnd,GWL_USERDATA
or        eax,2
invoke   SetWindowLong,hWnd,GWL_USERDATA,eax


Or with a bool flag like

bIsClicked,1
bIsMouseOver,1
...
..