Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) 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: 67
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: 162
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 = Asc13 ) 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 SP3 / Basic4PPC v6.5
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: 67
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox Focus cdeane Questions (Windows Mobile) 6 10-16-2008 03:17 PM
Capture name of control that has focus aerohost Questions (Windows Mobile) 5 06-21-2008 10:31 PM
set focus function gjoisa Questions (Windows Mobile) 3 05-13-2008 04:53 PM
Focus text in textbox! superbabicka Questions (Windows Mobile) 5 04-01-2008 11:48 AM
Focus pmu5757 Basic4ppc Wishlist 2 03-21-2008 05:11 PM


All times are GMT. The time now is 09:01 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0