Source language: Translate to:

Window focus

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby Wrangler » Thu Jul 20, 2006 8:13 am

Thanks, Gaev. That extra bit of code will be good to add. But, all my textentry boxes use database variables, and I can't figure out why it will work with [textentry1], and not [database.fieldname].

Dave: Any ideas?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Thu Jul 20, 2006 8:56 am

Wrangler:

Can you post a list of the ...

TextEntryNNN >>> [dbfX.FieldNameY]

... pairs that participate in this process ? ... having "the variables associated with TextEntry objectNames" identical to the objectNames just makes it efficient to code ... but as long as you are capturing/saving the objectName, there are other methods of populating them ... from a paired listing of the kind above.

BTW, were you able to confirm (via the AlertBox commands) that the correct objectName was being captured ... and the correct selected ComboBox entry content was being returned ?
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Wrangler » Thu Jul 20, 2006 9:07 am

Yes, I did confirm them, as posted earlier, posted while you were posting as well. :)

I will make a list and post it directly.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Wrangler » Thu Jul 20, 2006 9:16 am

TextEntry36item = [database.name]
TextEntry37 = [database.desc]
TextEntry38 = [database.produrl]
TextEntry39 = [database.imgurl]
TextEntry44 = [database.id]
TextEntry45 = [database.expdate]
pubdate = [database.pubdate]
author = [database.author]
TextEntry46 = [database.label]
source = [database.source]

The .desc is a memo field, but won't be used for this routine. Also, the dates will be pulled from a calendar plugin.

Thanks for your help with this, Gaev. It is the only barrier preventing the release of this project. :x
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Neosoft Support » Thu Jul 20, 2006 10:13 am

But, all my textentry boxes use database variables, and I can't figure out why it will work with [textentry1], and not [database.fieldname].


There's no reason that I know of that the name of the variable should make any difference.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Wrangler » Thu Jul 20, 2006 10:27 am

Dave: It would seem to me that it shouldn't make a difference as well. I thought maybe it was the auto save in neodb, but I turned it off, and it still won't work. I also tried disabling dbfdefinealias. It's a stumper.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Thu Jul 20, 2006 12:47 pm

Dave:
There's no reason that I know of that the name of the variable should make any difference.
... Wrangler is talking about it not working in this special context ... doing a SetVar "[[FocusedTextEntryBox]]" "[autofill1]" will ONLY work in an environment where TextEntry23 has an associated variable of [TextEntry23] ... in his case, there is no such relationship between objectName and [objectVariable].

Wrangler:
It is the only barrier preventing the release of this project
... since you only have a small number of these textEntry objects, you can use the brute force method of coding ... in place of ...
Code: Select all
SetVar "[[FocusedTextEntryBox]]" "[autofill1]"
... use ...
Code: Select all
If "[FocusedTextEntryBox]" "=" "TextEntry36"
   SetVar "[database.name]" "[autofill]"
EndIf
If "[FocusedTextEntryBox]" "=" "TextEntry37"
   SetVar "[database.desc]" "[autofill]"
EndIf

... etc. etc.

If "[FocusedTextEntryBox]" "=" "TextEntry46"
   SetVar "[database.label]" "[autofill]"
EndIf
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Wrangler » Thu Jul 20, 2006 12:58 pm

Yup. The ol' brute force will work. It won't be too bad on this page, but I've got 13 other pages, some with 40 fields. But, a man's gotta do what a man's gotta do. :wink:

Too bad it didn't work. Would have been pretty slick.

Thanks for all your help, Gaev.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Thu Jul 20, 2006 2:06 pm

Wrangler:

Try this as an improvement ...

a) somewhere in your Startup section ...
Code: Select all
SetVar "FieldForTextEntry36" "name"
SetVar "FieldForTextEntry37" "desc"

... etc.

SetVar "FieldForTextEntry46" "label"

b) Now, back to the ComboBoxes .... replace the brute force code with just ...
Code: Select all
SetVar "[database.FieldFor[FocusedTextEntryBox]]" "[autofill]"
... where I am assuming that ...

- either your database file is "database.dbf"

- or you have used dbfDefineAlias "yourFile.dbf" "database"
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Wrangler » Thu Jul 20, 2006 2:38 pm

Assuming you meant:

SetVar "[FieldForTextEntry36item]" "name"
SetVar "[FieldForTextEntry37]" "desc"

with the brackets?

This doesn't work at all. The debugger shows these variables:

FocusedTextEntryBox = OK
autofill = OK
database.fieldfortextentry36 = OK data wise, but this isn't a valid db variable. I don't understand what you had in mind here.

I also tried the setvar without the brackets. No go.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Wrangler » Thu Jul 20, 2006 2:53 pm

Using the brute force method:

If "[FocusedTextEntryBox]" "=" "TextEntry36item"
SetVar "[database.name]" "[autofill1]"
EndIf

it works after you first run the program, but when you select another textentry box, [FocusedTextEntryBox] doesn't update itself. It retains the first selection even after clicking in another textentry box.

Plus, the combo box will run an action when you select an item the first time, but won't run it when you select it again. Dave?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Wrangler » Thu Jul 20, 2006 3:42 pm

It appears

:groupautofill_onOpen
SetVar "[FocusedTextEntryBox]" "[FocusedObject]"
Return

only works once, when the custom window is opened. It won't work again until you close the window, and open it again.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Wrangler » Thu Jul 20, 2006 3:59 pm

From the help file:

[FocusedObject] The name of the object that has the input focus.

What is this used for? When putting the cursor in a textentry box, shouldn't this variable contain the object name? It doesn't for me.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Thu Jul 20, 2006 4:50 pm

Wrangler:
Assuming you meant:

SetVar "[FieldForTextEntry36item]" "name"
SetVar "[FieldForTextEntry37]" "desc"

with the brackets?

a) SetVar works the same with/without the brackets in the first parameter.

b) If the name of your object is FieldForTextEntry36item then yes, use that ... use the combination of [FieldFor and the objectName for the first parameter ... and the database field associated with the object in the second parameter ... no brackets around the second parameter.



Slight mistake on my part ... for the ComboBoxes .... replace the brute force code with ...
Code: Select all
SetVar "[thisField]" "[FieldFor[FocusedTextEntryBox]]"
SetVar "[database.[thisField]]" "[autofill1]"
... so if the TextEntry Box with focus is "TextEntry37" ...

- when the first command is serviced, [thisField] will be resolved in 2 steps ... first time around, it will resolve to [FieldForTextEntry37]" ... and this in turn will resolve to "desc"

- when the second command is serviced, [database.[thisField]] will be resolved in 2 steps ... first time round, it will resolve to [database.desc] ... and this in turn will resolve to the desc field of the current record of your database ... so this field will end up containing the contents of [autofill1]

Sorry about that omission.

This doesn't work at all. The debugger shows these variables:

FocusedTextEntryBox = OK
autofill = OK
database.fieldfortextentry36 = OK data wise, but this isn't a valid db variable. I don't understand what you had in mind here.
what do you mean by OK ? .. the actual text OK ... or what you expected ?
it works after you first run the program, but when you select another textentry box, [FocusedTextEntryBox] doesn't update itself. It retains the first selection even after clicking in another textentry box.

only works once, when the custom window is opened. It won't work again until you close the window, and open it again.
... looks like your CustomWindow is not operating in Exclusive Mode... this whole scheme assumes you operate in Exclusive Mode ... otherwise, [FocusedObject] returns value in CustomWindow !!! ... there is no such thing as "Focused object outside of the CustomWIndow"

Perhaps time to rethink your UI design ... perhaps a small button (or radio button) aside each TextEntryBox ... so user can click it (instead of inside the TextEntryBox) to cause [FocusedtextEntryBox] to be set explicitly ... and which would then also do a FocusObject "[FocusedTextEntryBox]"

Plus, the combo box will run an action when you select an item the first time, but won't run it when you select it again
... the routine gets triggered when Selection Changed ... not when Selection Made/Remade.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neosoft Support » Thu Jul 20, 2006 5:27 pm

Perhaps time to rethink your UI design ... perhaps a small button (or radio button) aside each TextEntryBox ... so user can click it (instead of inside the TextEntryBox) to cause [FocusedtextEntryBox] to be set explicitly ... and which would then also do a FocusObject "[FocusedTextEntryBox]"


I agree. Maybe even using Menu/MenuEx would be easier and faster than CustomWindow/ComboBox.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

PreviousNext

Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests