Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Focus


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-21-2008, 01:28 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Focus

Hello !
First, excuse the poor english of a frenchy...

I'm making a program that ask questions to the user.
The user must type the answer in a textbox, and then click an OK button to check if the answer is right or not.
To make the answer easier to type, I've set the focus on the answer textbox.
But it's impossible for the user to type enter instead ok clicking ok because the focus is not on the ok button.
Does it exist a solution to make it possible ?

Thank you

Pascal.
Reply With Quote
  #2 (permalink)  
Old 03-21-2008, 01:37 PM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 154
Default

The solution is to catch each keypress as the user types text into the box. If and when the user presses the Enter key, simply call the same subroutine that would be called if the user had clicked on the button.

Code:
sub Textbox1_KeyPress( pKey )

   if pKey = Asc( 13 ) then Button1_Click   ' 13 = the Enter key, if I remember correctly

end sub

sub Button1_Click

   msgbox( "Hello, World!" )

end sub
__________________
PC: Windows XP Pro SP2 / Basic4PPC v6.3
PPC: HTC 8925 (AT&T Tilt) / Windows Mobile 6

Last edited by willisgt : 03-21-2008 at 03:18 PM.
Reply With Quote
  #3 (permalink)  
Old 03-21-2008, 05:16 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Focus

It works very well, thank you.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture name of control that has focus aerohost Questions & Help Needed 5 06-21-2008 10:31 PM
set focus function gjoisa Questions & Help Needed 3 05-13-2008 04:53 PM
Focus text in textbox! superbabicka Questions & Help Needed 6 04-01-2008 11:48 AM
Focus pmu5757 Basic4ppc Wishlist 2 03-21-2008 05:11 PM
listbox focus select using textbox Dr. Feelgood Questions & Help Needed 2 02-15-2008 12:25 AM


All times are GMT. The time now is 12:48 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0