Page 1 of 1

Losing focus

PostPosted: Wed Oct 02, 2013 4:34 pm
by carlos torres
Dear NB Team
TIA
I have a combo with an special list, I load the data and select the first one. It is OK. I need to lose the focus after chossing the first item
How can I do that? I'd tried with getting focus on a button or any other object but it doesn't work. Any mouse move make to loose the selected item within the combo.

regards
carlost

Re: Losing focus

PostPosted: Wed Oct 02, 2013 7:16 pm
by Gaev
carlost:

I am having some difficulty understanding what you are trying to achieve.

I have a combo with an special list, I load the data and select the first one.
1) what is special about the list ?

2) How do you load the data ? ... please post the script/commands you are using.

3) How do you select the first entry ? ... via mouse click or via script/command ?

I need to lose the focus after chossing the first item
I'd tried with getting focus on a button or any other object but it doesn't work.
Do you have a FocusObject command in the Selection Changed section of the ComboBox Object ? ... if so, try specifying a TextEntry Object as the first parameter ... from the Help file ...

Set the keyboard input focus to a specific object. This Action is primarily used to activate Text Entry objects. Objects that don’t accept keyboard input are not affected by this Action.

Any mouse move make to loose the selected item within the combo.
I am sorry I don't understand how this relates to the rest of the post ... please explain in more detail.

Re: Losing focus

PostPosted: Wed Oct 02, 2013 8:47 pm
by David de Argentina
Hi Carlos,

I asume you has a variable like "one[#13]two[#13]three[#13]Four"
and set this variable as List Elements into a ListBox Object or you do:

ListBoxAddItem "ListBox1" "1" "One"
ListBoxAddItem "ListBox1" "2" "Two"
ListBoxAddItem "ListBox1" "3" "Three"
ListBoxAddItem "ListBox1" "4" "Four"

On your button, or actions page, or function, to set properly the initial value of a listbox, do the following

ListBoxGetItem "ListBox1" "1" "[Selected_Item]"

AND

You must put the after this, the same code you wrote at the ListBox1 -> Properties -> Change item


Using this way, your combo or listbox were correctly initializated, and no need to change focus and reset the first element of the object to put in work them.

My 0,01
David de Argentina

Re: Losing focus

PostPosted: Mon Oct 07, 2013 10:49 am
by carlos torres
Thanks to everybody

This is the code what I'm using
Code: Select all
    ListBoxSize "ListVideos" "[LenVideos]"
    FocusObject "ListVideos"
    SendKeys "" "{Down}{Up}"
    If "[LastError]" "<>" ""
       AlertBox "Error" "There is no videos available."
    EndIf

The Combo with the "ListVideos" keep the focus and any move with the mouse cause to lose/change the video name.
How can I avoid this?
I use a button to gain the new focus but it doesn't work niether
Code: Select all
FocusObject "btnFullScreen"
SendKeys "" ""
...///


I will appreciate your help.
regards,
carlost

Re: Losing focus

PostPosted: Mon Oct 07, 2013 1:29 pm
by Gaev
carlost:

I use a button to gain the new focus but it doesn't work niether
As stated in my previous email ... NeoBook Help file states that ...

This Action is primarily used to activate Text Entry objects. Objects that don’t accept keyboard input are not affected by this Action.

... so you can not set focus to a Button ... you need to specify a TextEntry object ... if you don't have one, you might consider placing a dummy one outside the visible application window.
The Combo with the "ListVideos" keep the focus and any move with the mouse cause to lose/change the video name.
How can I avoid this?
Assuming that the Variable (to store selected item) is called [Videos] ...

a) if you have chosen Variable contains ... to be Item Text ...
Code: Select all
ListBoxSize "ListVideos" "[LenVideos]"
If "[LenVideos]" "=" "0"
   AlertBox "Error" "There is no videos available."
Else
   ListBoxGetItem "ListVideos" "1" "[Result]"
   SetVar "[Videos]" "[Result]"
EndIf

b) if you have chosen Variable contains ... to be Item Number (1,2,3..) ...
Code: Select all
ListBoxSize "ListVideos" "[LenVideos]"
If "[LenVideos]" "=" "0"
   AlertBox "Error" "There is no videos available."
Else
   SetVar "[Videos]" "1"
EndIf


This code will set the first item in the list as the selected item ... it should keep focus ... and even if user selects another item in the list, you can get this information by examining the associated variable.

Re: Losing focus

PostPosted: Mon Oct 07, 2013 9:57 pm
by HPW
... so you can not set focus to a Button ...


That not full correctly.
When you have activate 'Book Properties\Access\Display visible marquee to indicate item with keyboard focus' then a button can have and show the focus.

Regards

Re: Losing focus

PostPosted: Tue Oct 08, 2013 10:58 am
by carlos torres
Thanks Gaev

I used what you said, a dummy text entry and it works!

regards,
carlost