Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shift Button and click???

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Greetings fellow programers, I am a ninth grade programer and I have a question about the LButtonDown command. I am making a program for my school that allows us to keep track of where on a basketball court someone shot. I have set lbuttondown to be a black "x" and rbuttondown to be a black circle. I want to be able to push shift and click to make the x and circle be a different color. I know how to change the color i just dont know how to incorperate shift.

CAN SOMEONE HELP ME? :Þ
 
Hi

I build a test sample with a button and a text box called IDC_SHIFT.
In the handler of the button click, I just added this:

int shift = GetKeyState(VK_SHIFT);

if( !(shift & 0xf0))
SetDlgItemText( IDC_SHIFT, "Not Shifted");
else
SetDlgItemText( IDC_SHIFT, "Shifted");

HTH

THierry
EMail: Thierry.Marneffe@swing.be
WebSite:
 
OnLButtonDown function has already its own parameter named 'nFlag'. Thus, if you use the WM_LBUTTONDOWN message just check this Flag to see if you are pressing the shift key.

if (nFlags & MK_SHIFT) {
DoWhateverYouHaveToDo();
}

In practice, it's what TGM already told you, but its method works even if you don't use this message s-)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top