Source language: Translate to:

Losing focus

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Losing focus

Postby carlos torres » Wed Oct 02, 2013 4:34 pm

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
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Re: Losing focus

Postby Gaev » Wed Oct 02, 2013 7:16 pm

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.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Losing focus

Postby David de Argentina » Wed Oct 02, 2013 8:47 pm

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
User avatar
David de Argentina
 
Posts: 1559
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Losing focus

Postby carlos torres » Mon Oct 07, 2013 10:49 am

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
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Re: Losing focus

Postby Gaev » Mon Oct 07, 2013 1:29 pm

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.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Losing focus

Postby HPW » Mon Oct 07, 2013 9:57 pm

... 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
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Losing focus

Postby carlos torres » Tue Oct 08, 2013 10:58 am

Thanks Gaev

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

regards,
carlost
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron