Page 1 of 2
					
				Focus on nothing not working on Windows? [SOLVED]
				Posted: Mon Jul 26, 2021 11:31 am
				by stam
				Hi all,
Slight cosmetic issue with 'focus on nothing' on Windows.
I'm building one of my apps on a Mac, but mainly intended to run on Windows. 
After a splash stack initialises the main stack, this brings up a login card - i have fields with placeholder text in the username/password fields. This placeholder text disappears when entering the field, so this doesn't show if the field has the focus. 
On Mac, i can just run 'focus on nothing' and both fields show their placeholder text.
On Windows, the last field always has the focus, hiding it's placeholder text - which is annoying.
Here's what it's supposed to look like:
Any suggestions to not allow any of the fields to get the focus after initialising?
 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 4:08 pm
				by andresdt
				Hello,
Here is a sample stack, although it is not exactly like the image, you already have an idea of how to do it.
Hope this helps you.
			 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 5:22 pm
				by jacque
				Does "select empty" work any better?
			 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 5:52 pm
				by andresdt
				Hope this does help you.
			 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 6:31 pm
				by stam
				Thanks @andresdt - i must be a bit dense today tho, how does this stop the fields from getting the focus on Windows?
			 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 6:42 pm
				by stam
				jacque wrote: ↑Mon Jul 26, 2021 5:22 pm
Does "select empty" work any better?
 
I'll try that when I'm at a windows work machine again - the rate limiting step for me is i don't have an easily accessible Windows machine for testing and in any case cannot replicate the locked down environment at the target machine, so i have build, transfer, test, fail and repeat 

getting there though!
 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 9:19 pm
				by FourthWorld
				"Focus on nothing" is not intended to be an executable statement in a script. It's a reminder for the scripter. Practiced with earnestness, it can help you transcend any need to worry about trying to make Windows look attractive. 

 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 9:44 pm
				by SparkOut
				FourthWorld wrote: ↑Mon Jul 26, 2021 9:19 pm
"Focus on nothing" is not intended to be an executable statement in a script. It's a reminder for the scripter. Practiced with earnestness, it can help you transcend any need to worry about trying to make Windows look attractive. 
 
 
I had to read that twice before I saw what you did there. 
If you had included a big image, I might have thought you were channelling Richmond.
 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 9:54 pm
				by jacque
				One more possibility: It's a result of LC's (irritating) auto-select of the first editable field when a card opens. If your password field is the first-layered one then that could be what's happening, though in theory it should do the same thing on Mac too. The workaround is to turn off traversalOn in preOpenCard and turn it back on using a "send" command after openCard finishes.
This probably isn't the reason since it doesn't happen on Mac, but maybe the workaround will fix it anyway. Another Windows-only workaround is to put a button at a lower level than the fields. On Windows, buttons can have traversalOn and the button would get the selection instead of the field.
			 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 10:09 pm
				by SparkOut
				Just for the record 
 is tested working on Windows here, using a basic stack.
I am not sure what is going on in the OP's stack, but it shouldn't 
need jiggery-pokery to work, but then there's jiggery-pokery going on with the placeholder text construction.
 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Mon Jul 26, 2021 10:13 pm
				by andresdt
				Apparently I need to sleep!
I don't know if I understand your problem.
what you want is that when entering the login card the username field is selected?
If that's, you can do like this:
Code: Select all
on openCard
    focus on field "username" of me
end openCard
then in the username field you can put:
Code: Select all
on enterInField
    focus on field "password" of this card
end enterInField
on returnInField
    enterInField
end returnInField
 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Tue Jul 27, 2021 5:38 pm
				by jacque
				Not exactly. When the card opens he wants nothing selected. LC auto-selects the first editable field and if that's what's happening then it's interfering with the default hint text for that field. There may be a timing issue involved.
If none of the suggestions here work, I think I'd send a specific command to show hint text after the card opens.
			 
			
					
				Re: Focus on nothing not working on Windows?
				Posted: Tue Jul 27, 2021 8:16 pm
				by stam
				Thanks 
@jacque
Timing was probably the issue in the standalone.
I have a card handler does some init stuff for the login fields and ends with '
focus on nothing'. I call this directly at the end of 
openStack. In the IDE this works fine but on the Win stand alone it didn't, leaving the focus on a field and spoiling the placeholder text effect.
This is what it's supposed to look like
This is what actually happened no matter what the code
Just annoying enough 
 
Taking a cue from Jacque's suggestion, Instead of call the handler directly, i tried using 
Code: Select all
send <init-handler> to me in 0.5 seconds
 and it works fine.
Well, fine-ish, as there is a quick flash where the field does get the focus but at this point i'll live with that.
Thanks all!
 
			
					
				Re: Focus on nothing not working on Windows? [SOLVED]
				Posted: Tue Jul 27, 2021 9:32 pm
				by FourthWorld
				Stam, is that for Mayo?
			 
			
					
				Re: Focus on nothing not working on Windows? [SOLVED]
				Posted: Tue Jul 27, 2021 11:06 pm
				by jacque
				I wonder if a lockscreen would overcome the flash.