Newsgroup: it.comp.programmare.win32
Titolo: Autocheckbox

Quali sono le funzioni che mi consentono di testare e cambiare lo stato di
un chekbox
(senza MFC)?
Grazie...
--------------------------------
Inviato via 
http://arianna.libero.it/usenet/

 
E' un argomento cosi' di base che basterebbe consultare una guida
famosa come quella del Petzold, o un tutorial di base sulle API...
A ogni modo:
A check box is a square box with text; the text usually appears to 
the right of the check box. (If you include the BS_LEFTTEXT 
style when creating the button, the text appears to the left;
 you'll probably want to combine this style with BS_RIGHT to 
right-justify the text.) Check boxes are usually incorporated
 in an application to allow a user to select options. The check
 box commonly functions as a toggle switch: clicking the box
 once causes a check mark to appear; clicking again toggles 
the check mark off. 
The two most common styles for a check box are BS_CHECKBOX 
and BS_AUTOCHECKBOX. When you use the BS_CHECKBOX style,
 you must set the check mark yourself by sending the control
 a BM_SETCHECK message. The wParam parameter is set to 1 to
 create a check mark and to 0 to remove it. You can obtain
 the current check state of the box by sending the control
 a BM_GETCHECK message. You might use code like this to
 toggle the X mark when processing a WM_COMMAND message
 from the control: 
SendMessage ((HWND) lParam, BM_SETCHECK, (WPARAM)
          !SendMessage ((HWND) lParam, BM_GETCHECK, 0, 0), 0) ;
Notice the ! operator in front of the second SendMessage call.
 The lParam value is the child window handle that is passed to
 your window procedure in the WM_COMMAND message. 
When you later need to know the state of the button,
 send it another BM_GETCHECK message. Or you can retain 
the current check state in a static variable in your window procedure.
 You can also initialize a BS_CHECKBOX check box with
 a check mark by sending it a BM_SETCHECK message: 
SendMessage (hwndButton, BM_SETCHECK, 1, 0) ;
For the BS_AUTOCHECKBOX style, the button control itself toggles
 the check mark on and off.
 Your window procedure can ignore WM_COMMAND messages.
 When you need the current state of the button, send the control 
 a BM_GETCHECK message: 
iCheck = (int) SendMessage (hwndButton, BM_GETCHECK, 0, 0) ;
The value of iCheck is TRUE or nonzero if the button is checked and
 FALSE or 0 if not. 
The other two check box styles are BS_3STATE and BS_AUTO3STATE.
 As their names indicate, these styles can display a third state
 as well預 gray color within the check box謡hich occurs when you
 send the control a WM_SETCHECK message with wParam equal to 2.
 The gray color indicates to the user that the selection is 
indeterminate or irrelevant. 
The check box is aligned with the rectangle's left edge
 and is centered within the top and bottom dimensions of
 the rectangle that were specified during the CreateWindow call.
 Clicking anywhere within the rectangle causes a WM_COMMAND
 message to be sent to the parent. The minimum height for a check box
 is one character height. The minimum width is the number
 of characters in the text, plus two. 
Saluti
JJ
-- 
Posted via Mailgate.ORG Server - 
http://www.Mailgate.ORG

 
Usa le macro CheckDlgButton e IsDlgButtonChecked
-- 
Il solo ed unico Piero Tofy
Web: 
http://www.pierotofy.it

 famosa come quella del Petzold, o un tutorial di base sulle API...
E' proprio quello che sto facendo... Solo che a voltre vengo colpito
da "rinco tremens", dimentico di andare a guardare nei posti piu'
ovvi e perdo due ore a cercare tra help on line e ng. :-)
Grazie ad entrambi...
-- 
questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news
 segnala gli abusi ad 
ab...@newsland.it