Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keypress track CTRL+1
Message
De
22/07/2011 08:55:33
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01518850
Message ID:
01518898
Vues:
71
This message has been marked as a message which has helped to the initial question of the thread.
>Hello,
>
>I tried to write a code in the Keypress event of the form which would track when the user presses a number with the CTRL button pressed. I was very surprised that the keypress event does not get triggered when pressing the CTRL and 1 key, up to Ctrl + 9. Only Ctrl+0 does raise the keypress event.
>
>Is there a workaround, or something that I overlook?


Ctrl+1 through ctrl+9 are not sent to the window


Alternatively, using bindevent


In the load()
if( !DoDefault() )
	return .f.
endif
#define WM_KEYUP                        0x0101


=bindevent(m.this.hwnd, WM_KEYUP, m.this, 'KeyUp', 0)
declare long GetAsyncKeyState in user32.dll long nkey
In the Unload()
=unbindevents(m.this.hwnd)


return dodefault()
Add a method KeyUp
lparameters hwnd, msg, wparam, lparam


#define ASCII_0			0x30
#define ASCII_1			0x31
#define ASCII_9			0x39

#define VK_CONTROL		0x11

do case
case !m.this.KeyPreview

case !between(m.wparam, ASCII_1, ASCII_9)

case !bittest(GetAsyncKeyState(VK_CONTROL), 15)

case !RaiseEvent(m.this, 'KeyPress', m.wparam, 2)

endcase
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform