If I have 2 forms, each one with a TextBox, and the text is changed with DEL key;
How to restore the original value of the textbox after having changed one form to other one?
If textbox1 gets the focus, the actual value is stored in a global variable. You don't need this, if you have already stored the textbox value in another variable in your appliction.
Change the value of the textbox and click on one of the other controls or somewhere at the main form. Now the lost focus event restores the original value of the textbox.
Isn't that what label are supposed to do?
Is it because of the border around the textbox that the Label don't have??
In that case put a panel slightly larger than the label, under the label, in order tore-create that effect...
With a bonus of not beeing editale, so your text is safe...
Another use of a 'locked' textbox is of course to allow different user access.
Some programs might need operator and supervisor access in which the textbox field would be 'locked' to operators but open for supervisors.
All solutions are either easy to go around or display a gray background. After much frustration (it was the last bug left after a bunch of random problems), I found a fix that seems to get the job done:
-Make another textbox and set it as invisible
-Add this code to your app:
B4X:
Sub YourTextbox_Gotfocus
InvisibleTextbox.Focus
End Sub
Notes: Do not set focus on a form, as it will set focus back to the textbox (and cause a stackoverflowexception of doom)
The drawback: You can't select text