B bidibulle Member Licensed User Longtime User Nov 7, 2007 #1 Hi, Is it possible to add the readonly property to the textbox control? It exist in VS2005. -- Pierre
Hi, Is it possible to add the readonly property to the textbox control? It exist in VS2005. -- Pierre
specci48 Well-Known Member Licensed User Longtime User Nov 7, 2007 #2 As a "workaround", set TextBox.Enabled = False, or uncheck the enabled checkbox directly in the form editor.
As a "workaround", set TextBox.Enabled = False, or uncheck the enabled checkbox directly in the form editor.
N Nkieto Member Licensed User Nov 7, 2007 #3 Problem with TextBox.Enabled = False or unchecking the enabled checkbox directly in the form editor is that textbox font color change to grey. What you can do is leaving Textbox enabled and add this method: Code: Copy Sub Textbox1_KeyPress (key) Textbox1.IgnoreKey End Sub Textbox is enabled but you can't write anything inside.
Problem with TextBox.Enabled = False or unchecking the enabled checkbox directly in the form editor is that textbox font color change to grey. What you can do is leaving Textbox enabled and add this method: Code: Copy Sub Textbox1_KeyPress (key) Textbox1.IgnoreKey End Sub Textbox is enabled but you can't write anything inside.
B bidibulle Member Licensed User Longtime User Nov 9, 2007 #4 Thanks Nkieto for the tips. I tested it. It works but it's not perfect. For the moment I will use it but if Erel can add the property in the next version it will be great. Anyway thanks for the support and thanks Erel for this great tool.
Thanks Nkieto for the tips. I tested it. It works but it's not perfect. For the moment I will use it but if Erel can add the property in the next version it will be great. Anyway thanks for the support and thanks Erel for this great tool.
agraham Expert Licensed User Longtime User Nov 9, 2007 #5 bidibulle said: I tested it. It works but it's not perfect. Click to expand... In what way? I tried it and it seems to feel the same to the user as setting the ReadOnly property. If you want to access properties not exposed by B4PPC and you have SharpDevelop or VS2003 or VS2005 you can always knock up a small library like the one attached. More generally to everyone else - after installing .NET 1.1 to get version 5.80 to compile I now "appear" to be able to target .Net 1.0 for the device with VS2005. I had assumed that I would need to install the whole .NET 1.1 SDK. Can somebody who only has .NET 1.0 on their device try this for me please! Attachments ReadOnly.zip ReadOnly.zip 2.5 KB · Views: 554
bidibulle said: I tested it. It works but it's not perfect. Click to expand... In what way? I tried it and it seems to feel the same to the user as setting the ReadOnly property. If you want to access properties not exposed by B4PPC and you have SharpDevelop or VS2003 or VS2005 you can always knock up a small library like the one attached. More generally to everyone else - after installing .NET 1.1 to get version 5.80 to compile I now "appear" to be able to target .Net 1.0 for the device with VS2005. I had assumed that I would need to install the whole .NET 1.1 SDK. Can somebody who only has .NET 1.0 on their device try this for me please!
taximania Well-Known Member Licensed User Longtime User Nov 10, 2007 #6 Hi agraham. Had a little play with your code. Attatched. On the Desktop. When ReadOnlyTextBox.ReadOnly = 'True or False' the textbox remains white and the text is black. On my Device. When ReadOnlyTextBox.ReadOnly = True the entire texbox is gray and the text is black. When TextBox2.Enabled = False, the textbox remains white and the text is gray on both Desktop and Device. Not sure if this is a useless post. It was just an observation. What I do know is that if I start a new #Sharp project and use your code, It will compile and run on the Desktop, but not my device :sign0148: Last edited: Nov 10, 2007
Hi agraham. Had a little play with your code. Attatched. On the Desktop. When ReadOnlyTextBox.ReadOnly = 'True or False' the textbox remains white and the text is black. On my Device. When ReadOnlyTextBox.ReadOnly = True the entire texbox is gray and the text is black. When TextBox2.Enabled = False, the textbox remains white and the text is gray on both Desktop and Device. Not sure if this is a useless post. It was just an observation. What I do know is that if I start a new #Sharp project and use your code, It will compile and run on the Desktop, but not my device :sign0148:
agraham Expert Licensed User Longtime User Nov 10, 2007 #7 taximania said: What I do know is that if I start a new #Sharp project and use your code, It will compile and run on the Desktop, but not my device :sign0148: Click to expand... It was a quickly knocked up to test a point and the reference to System.Text is not needed. However even with that the dll I compiled works on my device. Are you sure that your compilation is really targeting the device? I don't know SharpDevelop but I believe that it is easy to change the target by a menu option somewhere.
taximania said: What I do know is that if I start a new #Sharp project and use your code, It will compile and run on the Desktop, but not my device :sign0148: Click to expand... It was a quickly knocked up to test a point and the reference to System.Text is not needed. However even with that the dll I compiled works on my device. Are you sure that your compilation is really targeting the device? I don't know SharpDevelop but I believe that it is easy to change the target by a menu option somewhere.
D Deleted member 103 Guest Nov 10, 2007 #8 hi, here is my TextBoxReadOnly Ciao, Filippo Attachments TextBoxReadOnly.sbp TextBoxReadOnly.sbp 1.2 KB · Views: 608
agraham Expert Licensed User Longtime User Nov 10, 2007 #9 I am afraid your code is dangerous - you are adding an events every time the textbox gets the focus and the user can still select the text box. Try this Code: Copy Sub Globals 'Declare the global variables here. End Sub Sub App_Start Form1.Show End Sub Sub cmdShow_Click txtReadOnly.Text=txtReadWrite.Text End Sub Sub txtReadonly_GotFocus txtReadWrite.Focus End Sub
I am afraid your code is dangerous - you are adding an events every time the textbox gets the focus and the user can still select the text box. Try this Code: Copy Sub Globals 'Declare the global variables here. End Sub Sub App_Start Form1.Show End Sub Sub cmdShow_Click txtReadOnly.Text=txtReadWrite.Text End Sub Sub txtReadonly_GotFocus txtReadWrite.Focus End Sub
D Deleted member 103 Guest Nov 10, 2007 #10 Hallo agraham, You have not understood mine code! It should be only one beispiel like a text box readonly can become.
Hallo agraham, You have not understood mine code! It should be only one beispiel like a text box readonly can become.
B bidibulle Member Licensed User Longtime User Nov 10, 2007 #11 I prefer the DLL solution. With "Textbox1.IgnoreKey" you can select the text and delete the text I will try to improve the DLL to more property.
I prefer the DLL solution. With "Textbox1.IgnoreKey" you can select the text and delete the text I will try to improve the DLL to more property.
agraham Expert Licensed User Longtime User Nov 10, 2007 #12 Filippo said: You have not understood mine code! It should be only one beispiel like a text box readonly can become. Click to expand... Sorry Filippo but I am correct. I've run it in the IDE with a breakpoint on "AddEvent (objTextbox ,"KeyPress", "goIgnorekey")" in Sub ConvertTextboxToLabel(objTextbox) and every time you move the focus to txtReadWrite and then back to txtReadonly this statement is executed.
Filippo said: You have not understood mine code! It should be only one beispiel like a text box readonly can become. Click to expand... Sorry Filippo but I am correct. I've run it in the IDE with a breakpoint on "AddEvent (objTextbox ,"KeyPress", "goIgnorekey")" in Sub ConvertTextboxToLabel(objTextbox) and every time you move the focus to txtReadWrite and then back to txtReadonly this statement is executed.
B bidibulle Member Licensed User Longtime User Nov 10, 2007 #13 I improved the DLL and I changed the name. TextboxEx added the following property to the textbox: - ReadOnly : Readonly property - Maxlength : Maximum characters in the textbox - bsNone : No border - bsSingle : Single border - bs3D : 3D border I try to add the 'Textalign' property but it didn't work in the PPC :-( I attached the Sharpdevelop project and an example. View attachment TextBoxEx.zip View attachment TextBoxEx example.zip
I improved the DLL and I changed the name. TextboxEx added the following property to the textbox: - ReadOnly : Readonly property - Maxlength : Maximum characters in the textbox - bsNone : No border - bsSingle : Single border - bs3D : 3D border I try to add the 'Textalign' property but it didn't work in the PPC :-( I attached the Sharpdevelop project and an example. View attachment TextBoxEx.zip View attachment TextBoxEx example.zip
alfcen Well-Known Member Licensed User Longtime User Nov 16, 2007 #14 Gentlemen, these Textbox properties definitely belong into the IDE What do you think, Erel?
Erel B4X founder Staff member Licensed User Longtime User Nov 16, 2007 #15 I would consider it adding to Basic4ppc internal textbox. BTW, you can use FormLib to change the alignment.
I would consider it adding to Basic4ppc internal textbox. BTW, you can use FormLib to change the alignment.