|
Post by donjohn24 on Nov 3, 2022 11:00:50 GMT
Is there an instruction that causes characters typed into a textbox to overwrite the existing contents instead of adding to them? - My keyboard ins key (numLock OFF, 0/ins) has no effect
If there is no such instruction and it requires extra coding, where do I put the code when any of a number of textboxes can be selected by TABbing or with the cursor?
|
|
|
Post by honkytonk on Nov 3, 2022 12:01:02 GMT
NOMAINWIN mapw=500: maph= 400 WindowWidth=mapw+15: WindowHeight=maph+40 UpperLeftX = 10: UpperLeftY = 20 TEXTBOX #w.coeff, 55 , 20, 100, 25 BUTTON #w.n1, "Go!", [go], UL, 200, 20, 40, 20 BUTTON #w.n2, "Gogo!", [gogo], UL, 260, 20, 40, 20 GRAPHICBOX #w.g, 5, 5, mapw, maph OPEN "Help" FOR window_nf AS #w #w, "TRAPCLOSE [closeHelp]" #w.g, "down;fill darkpink;color white;backcolor darkpink" #w.coeff, "!font courrier 12 bold" coeff=50 #w.coeff, str$(coeff) wait [go] #w.coeff, "Changed" wait [gogo] a$="Youhou": #w.coeff, a$ wait [closeHelp] CLOSE #w END
|
|
|
Post by plus on Nov 3, 2022 12:05:16 GMT
Really do need the discussion on Variables for Controls, so you run same code over multiple controls.
As far as typeover goes, just select text you don't want and start typing text you do, just like in this forum editor.
|
|
|
Post by tsh73 on Nov 3, 2022 12:35:00 GMT
Really interesting Things we take for granted are, well, not actually granted ;) - and plain does not work as *I* "remember"!
So my testing: JB textbox and texteditor ignore Ins key (does not change insert/overwrite, always do Insert) JB editor (IDE itself) ignores Ins key
*drums* Windows Notepad ignores Ins key (! I never guessed that !!)
Now, firing up old Visual Studio Express (2010) textbox ignore Ins key multiline ignore Ins key richtextbox makes this key actually work (changes insert/overwrite)
So WordPad makes ithis key work, too.
|
|
|
Post by donjohn24 on Nov 3, 2022 13:11:46 GMT
As far as typeover goes, just select text you don't want and start typing text you do, just like in this forum editor. Yes, I understand that is an option, but consider the actual use of a program where the user may want to enter 16 scores, one after the other. Overtyping the existing contents of textboxes and pressing TAB to go to the next is easily - and quickly - achieved from the keyboard. Hovering a clicked mouse cursor exactly over existing entries and typing new scores 16 times is cumbersome, time consuming, and prone to error. So you see why I would so like to be able to overtype and make life easier for the user.
|
|
|
Post by donjohn24 on Nov 3, 2022 13:26:32 GMT
NOMAINWIN mapw=500: maph= 400 WindowWidth=mapw+15: WindowHeight=maph+40 UpperLeftX = 10: UpperLeftY = 20 TEXTBOX #w.coeff, 55 , 20, 100, 25 BUTTON #w.n1, "Go!", [go], UL, 200, 20, 40, 20 BUTTON #w.n2, "Gogo!", [gogo], UL, 260, 20, 40, 20 GRAPHICBOX #w.g, 5, 5, mapw, maph OPEN "Help" FOR window_nf AS #w #w, "TRAPCLOSE [closeHelp]" #w.g, "down;fill darkpink;color white;backcolor darkpink" #w.coeff, "!font courrier 12 bold" coeff=50 #w.coeff, str$(coeff) wait [go] #w.coeff, "Changed" wait [gogo] a$="Youhou": #w.coeff, a$ wait [closeHelp] CLOSE #w END
I'm sorry, I don't understand. I want to be able to overtype 50 with - say - 44 - and see it has happened
|
|
|
Post by donjohn24 on Nov 3, 2022 13:30:57 GMT
Really interesting Things we take for granted are, well, not actually granted - and plain does not work as *I* "remember"! So my testing: JB textbox and texteditor ignore Ins key (does not change insert/overwrite, always do Insert) JB editor (IDE itself) ignores Ins key *drums* Windows Notepad ignores Ins key (! I never guessed that !!) Now, firing up old Visual Studio Express (2010) textbox ignore Ins key multiline ignore Ins key richtextbox makes this key actually work (changes insert/overwrite) So WordPad makes ithis key work, too. So, are you just confirming that there is no way to use the ins key in JB - and some other apps? - BUT the ins key DOES work in my Notepad, Wordpad, and in Word
|
|
|
Post by tsh73 on Nov 3, 2022 14:46:06 GMT
Yes. It does not work in many many apps I guess. I pretty sure Visual Studio uses native Windows controls - and it seems to me, by default text editor control does not do it.
You said it works for you in notepad. This is interesting I tested on Win 10 64, some LTSB version ( that is rather old) And it does not work. I just googled and folks say it doesnt work. May be you use something more advanced then Windows notepad?
As for wordpad and word - they does not use text editor control. It would be no fun - no different fonts, colors and font sizes in one text.
|
|
|
Post by donjohn24 on Nov 3, 2022 15:04:11 GMT
May be you use something more advanced then Windows notepad? Sorry, works in Notepad++ but not in plain Notepad
|
|
|
Post by plus on Nov 3, 2022 15:13:50 GMT
As far as typeover goes, just select text you don't want and start typing text you do, just like in this forum editor. Yes, I understand that is an option, but consider the actual use of a program where the user may want to enter 16 scores, one after the other. Overtyping the existing contents of textboxes and pressing TAB to go to the next is easily - and quickly - achieved from the keyboard. Hovering a clicked mouse cursor exactly over existing entries and typing new scores 16 times is cumbersome, time consuming, and prone to error. So you see why I would so like to be able to overtype and make life easier for the user. Yes you can write code to clear text boxes when use a screen full of them. Again using a variable for control comes into play but I am rusty on how to set it up. Something like naming all textboxes tb1, tb2, tb3, tb4... (can't use array for controls but that would be perrrrfect!) then something like ' on button Clear Click for i = 1 to 10 ' index for textboxes #gr.tb;i, text = "" next Also you can select by pressing shift + end or shift + home to select and clear happens when just start typing new value.
|
|
|
Post by plus on Nov 3, 2022 15:34:17 GMT
Lets mod honktonk to our purpose of discussion:
NOMAINWIN mapw=500: maph= 400 WindowWidth=mapw+15: WindowHeight=maph+40 UpperLeftX = 10: UpperLeftY = 20 TEXTBOX #w.coeff, 55 , 20, 100, 25 BUTTON #w.n1, "Clear", [go], UL, 200, 20, 40, 20 BUTTON #w.n2, "Hi", [gogo], UL, 260, 20, 40, 20 GRAPHICBOX #w.g, 5, 5, mapw, maph OPEN "Help" FOR window_nf AS #w #w, "TRAPCLOSE [closeHelp]" #w.g, "down;fill darkpink;color white;backcolor darkpink" #w.coeff, "!font courrier 12 bold" coeff=50 #w.coeff, str$(coeff) wait [go] #w.coeff, "" wait [gogo] a$="Hi DonJohn24": #w.coeff, a$ wait [closeHelp] CLOSE #w END
Now you have a Clear button to Clear text
|
|
|
Post by donjohn24 on Nov 3, 2022 15:39:26 GMT
Yes, I understand that is an option, but consider the actual use of a program where the user may want to enter 16 scores, one after the other. Overtyping the existing contents of textboxes and pressing TAB to go to the next is easily - and quickly - achieved from the keyboard. Hovering a clicked mouse cursor exactly over existing entries and typing new scores 16 times is cumbersome, time consuming, and prone to error. So you see why I would so like to be able to overtype and make life easier for the user. Yes you can write code to clear text boxes when use a screen full of them. Again using a variable for control comes into play but I am rusty on how to set it up. Something like naming all textboxes tb1, tb2, tb3, tb4... (can't use array for controls but that would be perrrrfect!) then something like ' on button Clear Click for i = 1 to 10 ' index for textboxes #gr.tb;i, text = "" next Also you can select by pressing shift + end to clear and just start typing new value. Again, clearing is a possible option for all scores to be changed, but if only one needed to be updated, how to determine just that one to be cleared? shift + end will work, as does using the DELETE key, but again not as easy as overtyping I have already been considering lots of these sorts of options, but, in my opinion, none are really any better than using the DELETE key if overtyping is NOT possible
|
|
|
Post by tsh73 on Nov 3, 2022 15:45:26 GMT
Really, JB offers too little tools to work with this. We cannot reliably (or at all) tell what control we are in, where caret in that control. There is no golden hammer. Sometimes you just need another tool.
|
|
|
Post by plus on Nov 3, 2022 15:46:26 GMT
Here is Clear buttom clearing several text boxes:
NOMAINWIN mapw=500: maph= 400 WindowWidth=mapw+15: WindowHeight=maph+40 UpperLeftX = 10: UpperLeftY = 20 TEXTBOX #w.tb1, 55 , 20, 100, 25 textbox #w.tb2, 55, 65, 100, 25 textbox #w.tb3, 55, 130, 100, 25 textbox #w.tb4, 55, 195, 100, 25 textbox #w.tb5, 55, 260, 100, 25 textbox #w.tb6, 55, 325, 100, 25
BUTTON #w.n1, "Clear", [go], UL, 200, 20, 40, 20 BUTTON #w.n2, "Hi", [gogo], UL, 260, 20, 40, 20 GRAPHICBOX #w.g, 5, 5, mapw, maph OPEN "Help" FOR window_nf AS #w #w, "TRAPCLOSE [closeHelp]" #w.g, "down;fill darkpink;color white;backcolor darkpink" #w.tb1, "!font courrier 12 bold" #w.tb1, 100 wait [go] #w.tb1, "" #w.tb2, "" #w.tb3, "" #w.tb4, "" #w.tb5, "" #w.tb6, "" wait [gogo] a$="Hi DonJohn24": #w.tb2, a$ wait [closeHelp] CLOSE #w END
I am sure there is way to writing all this over and over again with a Control variable:
#w.tb1, "" #w.tb2, "" #w.tb3, "" #w.tb4, "" #w.tb5, "" #w.tb6, ""
But I don't remember how it was done.
|
|
|
Post by donjohn24 on Nov 3, 2022 15:55:43 GMT
Really, JB offers too little tools to work with this. We cannot reliably (or at all) tell what control we are in, where caret in that control. There is no golden hammer. Sometimes you just need another tool. I am reluctantly coming to the conclusion that what you say is true - particularly because of that second sentence. Unless some really smart hacker can create what you call a golden hammer to activate the ins key, or create a function to allow overtyping, I'm stuck with my current method - which is OK, but could be even better! Thanks to everyone for looking at my question.
|
|