TextField Input Masks : CTRL+any key = random ASCII characters

Question: I have some TextFields with Masks (One is > for all uppercase - one is for numbers ####, etc etc)

I can right click and copy and right click and paste, but doing CTRL+C or CTRL+V creates bizarre characters. (CTRL + any key does)

CTRL+C =

CTRL+V =

CTRL+Z =

CTRL + H = Simulates pressing backspace

Control + Other keys do other random characters.

Am I doing something wrong or is this expected behavior for a TextField mask? Why does it do this on only TextFields with masks, and is there a way to restore default TextField functionality to a masked TextField

This is all on Windows; I haven’t tested it on OS X with Command key

[edit] I have confirmed this behavior only exists on Windows; OS X does not encounter such characters with either CMD or CTRL

Sorry to bump, but I am still having this issue.

I made a demo program. Can someone open/investigate/run this on Windows (8.1 / 10) and see if they have the same issue?

Save text here as “maskproblem.xojo_xml_project” and open with Xojo


The first text field is the " > " mask which should make all letters capital. It works, but try to CTRL+C or CTRL+V to copy and paste. See the ASCII characters and/or ASCII boxes?

The second text field’s mask is " >DOG####### " - try to type DOG1234 and then copy it with CTRL+C … does it create “OG” for you then?

These are the issues I am encountering with the mask function.

This only affects Windows, and does not seem to be an issue on Mac OS X

Thanks to anyone who has time to look at this. Sorry for pasting the program code as Xojo XML but I don’t want to go make a Dropbox account for a 25 KB demo program :slight_smile:

Did you REMOVE THE DEFAULT menus for the application? From the screen shot, it looks like you did.
Those MUST remain intact for the cut/paste/select all etc keys to work.
You can HIDE them if you wish, but you cannot DELETE them

Dave,

That was indeed the issue. The issue is I cannot hide the menu bar on Windows :

http://documentation.xojo.com/index.php/MenuItem.Visible

So I guess I either have to see a menu bar I don’t want, or lose Copy+Paste shortcut capabilities?

[EDIT]

Also, even without the menu bar shortcuts work (Copy, Paste, Select All, etc…) it’s ONLY when there is a MASK applied to a TextField that the problem exists and required the menu bar

I’d file a bug report as with / without a mask should not matter but certainly seems to

you can have cut/paste etc without the menubars… BUT you have to intercept the keys and deal with them yourself… its a royal PITA, but can be done

Dave - cut copy paste etc work (at least in Windows & OS X) without the menu bar and NO special code to handle them
Reread Zachary’s post where he says [quote=264999:@Zachary Milbourn]
Also, even without the menu bar shortcuts work (Copy, Paste, Select All, etc…) it’s ONLY when there is a MASK applied to a TextField that the problem exists and required the menu bar[/quote]

It’s ONLY when the mask is applied that the issue arises

Thanks guys. I placed a bug report in Feedback.

[quote=264999:@Zachary Milbourn]Dave,

That was indeed the issue. The issue is I cannot hide the menu bar on Windows :

http://documentation.xojo.com/index.php/MenuItem.Visible[/quote]

Nope : http://documentation.xojo.com/index.php/Window.MenuBarVisible

perhaps you cannot set the ENTIRE menubar hidden, but that is not what I meant… hide the EDIT menu item individually

EditMenu.visible=false

(Pardon my ignorance as I haven’t dealt with MenuBars much)

I tried to toggle each menu item (File, Edit) as such:

…with no luck. They still show up.

So I tried with the code you posted:

[quote] EditMenu.Visible = False
FileMenu.Visible = False
[/quote]

It makes them invisible but still clickable:

I tried to also disable them as such:

[quote] EditMenu.Enabled = False
FileMenu.Enabled = False
[/quote]

…but it doesn’t seem to affect them still being clickable while invisible.

This is still a good workaround though, even if they are clickable while invisible. Thanks.

Under Windows you can hide the entire menu, but not specific menuItems. That is why I posted a link to http://documentation.xojo.com/index.php/Window.MenuBarVisible when you said you could not hide the menu.

If you want to hide menuitems, you can also create different versions of the menubar, some with and others without, and switch the active menu bar for the window with self.menuBar.

I am sorry I misunderstood your previous post… I just tried it Michel and that works really well! It hides the menu bar but retains the copy and paste functionality on Windows.

Thank you Dave, Michel, and Norman. The issue is now resolved on my program!

Woops wait!

me.MenuBarVisible = False

Makes the entire Windows TaskBar invisible too!

if you set

Me.MenuBar = Nil

like the documentation says, then the Mask bug comes back where CTRL + any key = Random ASCII character

There’s seems to be no way around this

[EDIT]

Even when the MenuBar is visible, keys other than CTRL+C, CTRL+V (things in the Edit menu) still create ASCII characters

Could you create a small project that shows the issue ? I cannot reproduce what you describe here.

What other keys? there are only Ctrl- Z, X, C, V and A

  • Did you add some of your own?
  • If so, are you sure you defined them properly in the Menu Editor?
  • And did NOT attempt to over-ride keys used by OSX and/or Windows (depending on which OS you are using)

Like Michel suggested, post a link to a small project that replicates the situation, and explain what you expect to see vs what you do see

Any other keys. I did not add any other shortcuts.

This is on Feedback as well, but here is the project file:

https://www.mediafire.com/?drfvg5qarmzf2d2

For example in this project, I go to the second TextField and I hold CTRL and then type the alphabet (a,b,c,d,e,f,g, etc etc)

The characters in this screenshot are the result of CTRL+Alphabet

Ok… CTRL A - Z… these are not normally “printable” characters… so exactly what did you expect?
On OSX… check out OPTION A-Z, these too will give “special characters”, but then that is by design

I did fire up a Mac and did Option+letters and it types characters in the manner which you described. It seemingly occurs in any application. I am not a Mac user so this is foreign to me, but apparently this is par for the course.

That is not normal behavior for Windows, however. I can’t go to any other application (Notepad), hold CTRL and get ASCII characters.

Why does it produce these characters when a mask is applied but it does not produce them without a mask?

i’m surprised you’re not seeing it. The behavior is documented: