Solved

Readonly textbox still has "I" insert bar icon

Posted on 2004-10-13
7
233 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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