News:

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

Main Menu

Autoradiobuttons help.

Started by xandaz, June 28, 2020, 07:09:12 AM

Previous topic - Next topic

xandaz

    hey guys. thanks in advance. I've been trying my way around autoradiobuttons but havent got a clue to what message to process. can someone help out?
    thanks

jj2007

Attached a test case, it shows the messages that you get when clicking. The *.asc source opens in WordPad or RichMasm.

hutch--

It really works for you to get hold of the old WIN32.HLP file as it has all of this core information. You have to learn your way around it but it will save you heaps of time. Translation from C is easy enough in most instances, DWORD in size and you make sure you understand the differences between a variable passed by VALUE or a POINTER. The pointer in win32 is always a DWORD as well.

jj2007

That's correct, but instead of guessing which of the hundreds of messages is the right one, it's often much faster to simply look which messages are sent when you click on the control. A button sends three messages, and WM_MOUSEACTIVATE is not the right one.

hutch--

Look up these messages,

BM_SETCHECK
BM_GETCHECK


jj2007

Quote from: xandaz on June 28, 2020, 07:09:12 AMwhat message to process

QuoteAn application sends a BM_GETCHECK message to retrieve the check state of a radio button or check box

You can use BM_GETCHECK to check the state, but before that, you need to process the message that the OS sends to you. Every click on the control produces three messages. One of them has even the control's ID.

K_F

Create radios with Button Class
if you're looking at auto radios include the BS_AUTORADIOBUTTON style (bold text below),  and use WM_COMMAND Notification in the parent window procedure to BM_GETCHECK the status of the radio


FFT_GUI_CreateCustRad_Freq Proc USES ESI hWin:DWord, ptr_hObject:DWord
Invoke CreateWindowEx, NULL,
ADDR sz_Class_Button, ; "BUTTON",0
ADDR sz_CustRad_Frequency,
WS_CHILD or WS_VISIBLE or [b]BS_AUTORADIOBUTTON[/b] OR WS_BORDER,
Gen_Rect.left,
Gen_Rect.top,
Gen_Rect.right,
Gen_Rect.bottom,
hWin,
NULL,
MainWin_Handles.hInstance,
NULL
mov esi, ptr_hObject
mov [esi], eax
    invoke ShowWindow,eax,SW_SHOW
ret
FFT_GUI_CreateCustRad_Freq endp



Here I've just subclassesd the window procedure for the radio buttons, which uses another proc to play with it.
From the Win API the Button Class cannot be sub-classed so you have to use the parent procedure/sub class procedure

;---RADIO BUTTON WINPROC---
WinProc_FFT_Cust_Grp Proc hWin:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD

.if uMsg == WM_COMMAND
mov eax, lParam
cmp eax, Handles_FFT_CustGrp.h_GUI_Cust_Rad_Freq
jne @F
Invoke WinProc_FFT_Cust_Rad_Freq, lParam, uMsg, wParam, lParam
jmp WPCustGrp_EX
@@:
cmp eax, Handles_FFT_CustGrp.h_GUI_Cust_Rad_Impuls
jne @F
Invoke WinProc_FFT_Cust_Rad_Imp, lParam, uMsg, wParam, lParam
jmp WPCustGrp_EX
@@:
cmp eax, Handles_FFT_CustGrp.h_GUI_Cust_Rad_Kernel
jne @F
Invoke WinProc_FFT_Cust_Rad_Kernel, lParam, uMsg, wParam, lParam
.endif

WPCustGrp_EX:
invoke CallWindowProc, Handles_FFT_CustGrp.ptr_Cust_Grp, hWin, uMsg, wParam, lParam
ret
WinProc_FFT_Cust_Grp endp
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

xandaz

   yeah. it was the BM_GETSTATE message. thanks