Solved

Readonly textbox still has "I" insert bar icon

Posted on 2004-10-13
7
231 Views
Last Modified: 2010-04-23
Hello Folks:

I am putting together a game GUI which contains several textboxes abstracting dice.  As such, I want these textboxes to be read only - my program will be the only thing that writes to these text boxes.

I need these boxes to be enabled as I need to process mouse events that occure on these boxes.  Also, I do not want the text to be muted - which happens when enabled=false.  So I am running enabled = true, readonly = true.  I've tried locked = true and false - my problem is the same.

The problem is - when the program starts all the readonly textboxes are empty.  There is an "I" insert bar in the upper left most text box.  If I type - nothing is echoed in the box - so I am confident the box is read only.

How do I get rid of the "I" bar?

Thanks in advance!
0
Comment
Question by:jflanner
7 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12297049
Well the I icon will show whenever it has focus so you can avoid setting focus on the textboxes.

One way is to code the GotFocus of each textBox to set focus to some other control.

0
 
LVL 34

Expert Comment

by:flavo
ID: 12297072
use a label?
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12297096
another Idea is (Check it out if it really works I have not checcked it)

Define a custom Cursor instead of the I i.e. IBeam cursor, this cursor will be a blank image of same backColor as that of the TextBox then instead of the default Ibeam cursor set this new cursor for each TextBox using

TextBox1.Cursor=new Cursor("The new Cursor Path")

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 9

Accepted Solution

by:
checoo earned 250 total points
ID: 12297128
the easiest way is to have an additional textbox on the form. Set the height and width of this textbox to zero and set the focus  to this textbox when the form loads. SO when the form loads the user will not be able to see the "I" as this textbox will be practically invisible.
0
 

Author Comment

by:jflanner
ID: 12309690
checoo

I like the idea of moving the focus to a different component.  Now my really stupid question is - how do I do that?  I coded a load event handler:

    Private Sub BoggleGUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.textboxBoggleDie01.Focus()
    End Sub

But this does not seem to be working.  Any ideas???
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12316146
You need to use SetFocus method on getFocus of the textBox

see your user might click on the TextBox as well, in that case the focus will again shift to the TextBox so as I said earlier On the GotFocus event of the TextBox pass the focus to the dummy textBox

 Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
        TextBox2.Focus()
End Sub

0
 
LVL 9

Expert Comment

by:checoo
ID: 12316197
suppose you have a text box with name txtDummy then in the form load event you can use the following statement

txtDummy.focus()
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now