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.

Disable textbox and font color

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-13-2008, 02:36 AM
Newbie
 
Join Date: Feb 2008
Posts: 7
Default Disable textbox and font color

I want to output to a textbox but I don't want the user to be able to edit it. Disabling it works nicely but I can't seem to control the color, I only can get that disabled grey color no matter what I set as font color. I can change the background color, just not the font. Is there maybe another way to disable the text box?
Reply With Quote
  #2 (permalink)  
Old 02-13-2008, 03:29 AM
brathbone's Avatar
Junior Member
 
Join Date: Feb 2008
Location: Rutherfordton, North Carolina
Posts: 25
Send a message via MSN to brathbone
Default

You could use ignorekey in the KeyPress Event for your textbox:

Sub TextBox1_KeyPress (key)
textbox1.IgnoreKey
End Sub

Does that achieve the desired effect?

hth,
__________________
Brian Rathbone

Author of The Dawning of Power fantasy trilogy. Get the eBook for only $7.99

Device: Treo 750, WM6, 300mhz,128MB RAM, 2GB miniSD, 240x240 display
Reply With Quote
  #3 (permalink)  
Old 02-13-2008, 08:05 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

You have different possibilites:
1. As already written by brathbone use the IgnoreKey in TextBox_KeyPress

2. Use the TextBoxEx library, with the ReadOnly property
http://www.basic4ppc.com/forum/showt...xtboxex&page=2

or this library with similars properties
http://www.basic4ppc.com/forum/additional-libraries/1238-fgcontrols-library.html

3. Use Label object
Label1.Text="123"
You can play with all the colors

Disadvantages from my point of view:
1. 2. The select highlighting still remains, which can be confusing for the user
3. There is no Border Property

We should remember what the TextBox and Label objects are primary intended for:
Label Display text, when the user has never to edit any data.
TextBox Enter text with a certain number of functions.
The gray text shows the user that at certain steps in the program the editing is disabeled.

Best regards

Klaus
Switzerland

Last edited by klaus : 02-13-2008 at 08:21 AM.
Reply With Quote
  #4 (permalink)  
Old 02-14-2008, 12:18 AM
Newbie
 
Join Date: Feb 2008
Posts: 7
Default

Thank you both, the suggestions worked well. I see what you mean about the highlighting, I suppose if I really wanted to be flashy I could design my own output box image and use the label command in the middle of it to give the desired effect. Thanks again for the help.
Reply With Quote
  #5 (permalink)  
Old 02-14-2008, 06:56 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Another "small trick" would be to change the focused control upon textbox get focus...But it could also lead to un-wanted behavior...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
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
How can i change the color of text in textbox? fishworld2006 Questions (Windows Mobile) 1 08-25-2008 04:54 AM
Font Problem ?? nm7s9 Questions (Windows Mobile) 6 08-08-2008 11:00 AM
different Font at .drawstring MM2forever Questions (Windows Mobile) 3 06-30-2008 05:45 PM
Disable entries in ComboBox klaus Questions (Windows Mobile) 4 05-02-2008 01:46 PM
How to disable launch application at given time? jesb4ppc Questions (Windows Mobile) 4 07-11-2007 04:48 PM


All times are GMT. The time now is 06:54 AM.


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