Page 1 of 1 1
Topic Options
#146247 - 2005-08-23 04:02 PM execute () variables not passing when expected.
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
WKIX 4.23 & KixForms.dll 14-08-2004
I have spent some time trying to get to the bottom of why I get spurious errors in my current project, it turns out the values assigned and the executed results are not as expected. The following code written for this post shows that what you would expect to appear in #1 ends up in #2 and so on, very strange. I can not rely on passing into a form variable or successfully extract and test from a form variable. On trying to pass back to $txt I have tried all these combinations and none seem to pass back the value of $VARIABLE1.Text
Anyone any idea what is going on...
Code:

;Test Sample partial code for KixForm - trouble passing data to/from variables - Out of sync !
setoption("NoVarInString","Off")
setoption("WrapAtEOL","on")
debug on
? "Test"
$TBN = "$VARIABLE1"
$TX1 = "1st-Text"
; Partial Form Code

$_ = execute("$$#$TBN = $$PForm.TextBox()")
$_ = execute("$$#$TBN.MaxLength = 10")
$_ = execute("$$#$TBN.Text = $$TX1")
? "#1=" $VARIABLE1.Text
$_ = execute("$$#$TBN.Text = '2nd-Text'")
? "#2=" $VARIABLE1.Text

;other code
$VARIABLE1.Text = "3rd-text"
$_ = execute("$$txt = $$TBN.TEXT")
;$_ = execute("$$txt = $$#$TBN.TEXT")
;$_ = execute("$$#$txt = $$TBN.TEXT")
;$_ = execute("$$#$txt = $$#$TBN.TEXT")

? "#3=" $txt
? "#4=" $VARIABLE1.TEXT
$A = len($txt)
? $A
debug off

sleep 5



Top
#146248 - 2005-08-23 04:47 PM Re: execute () variables not passing when expected.
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I would use novarinstrings ON, not OFF.


and this looks like a typo... "$$#$TBN" ???

Code:

;Test Sample partial code for KixForm - trouble passing data to/from variables - Out of sync !
setoption("NoVarInStrings","ON")
setoption("WrapAtEOL","on")
debug on

? "Test"

$TBN = $VARIABLE1
$TX1 = "1st-Text"
; Partial Form Code

$_ = execute("$TBN = " + $PForm.TextBox())
$_ = execute("$TBN.MaxLength = 10")
$_ = execute("$TBN.Text = " $TX1)
? "#1=" $tbn.Text
$_ = execute("$TBN.Text = '2nd-Text'")
? "#2=" $TBN.Text

;other code
$VARIABLE1.Text = "3rd-text"
$_ = execute("$txt = " + $TBN.TEXT)

? "#3=" $txt
? "#4=" $VARIABLE1.TEXT
$A = len($txt)
? $A



Edited by Bryce (2005-08-23 04:53 PM)

Top
#146249 - 2005-08-23 04:52 PM Re: execute () variables not passing when expected.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
NoVarsInStrings (plural)

Edited by Les (2005-08-23 05:23 PM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#146250 - 2005-08-23 05:02 PM Re: execute () variables not passing when expected.
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
Dont be distracted by the standard test heading, it does not make a difference whether on or off with this problem !
Cut & paste and try and let me know what your results show...please

Top
#146251 - 2005-08-23 05:13 PM Re: execute () variables not passing when expected.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Would be a big help if you could provide a complete script(let), with Form and Textbox already created - as it is, we really dont have anything to cut & paste into.
Top
#146252 - 2005-08-23 07:41 PM Re: execute () variables not passing when expected.
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
If you really wish, then fine I will prepare a bigger script however the primary issue is not the form but the data for seeding the form. The scriptlet shows the creation of a form variable and the variety of means of supplying data to it.For some reason #1 is given a value but when checked = ? it is blank, yet the variable is reset with #2 and displayed but then it is showing the value of #1.. I can not rely on the value being there when it is suposed to be ... or so it seems.
Top
#146253 - 2005-08-23 09:39 PM Re: execute () variables not passing when expected.
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
If you want us to test this, you'll have to post a working script. As posted, that script simply will not work. There is no form created in that script, in fact the KiXforms object is not created.
Top
#146254 - 2005-08-25 03:46 AM Re: execute () variables not passing when expected.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And is is recommended to use NoVarsInString=ON as is makes coding of EXECUTE much easier.
_________________________
There are two types of vessels, submarines and targets.

Top
#146255 - 2005-08-26 03:04 AM Re: execute () variables not passing when expected.
BoxKite Offline
Da Box
*****

Registered: 2000-05-17
Posts: 282
Loc: Vacaville,CA,USA
I’m not sure I’m getting the drift of what you are trying to do so please take the following for what its worth; if any.

Code:
;Test Sample partial code for KixForm - trouble passing data to/from variables - Out of sync ! 
setoption("NoVarsInString","on")
setoption("WrapAtEOL","on")
debug on
? "Test"
$TBN = "$VARIABLE1"
$TX1 = "1st-Text"
; Partial Form Code
$_ = execute("$$#$TBN = $$PForm.TextBox()")
$_ = execute("$$#$TBN.MaxLength = 10")
? ?
$_ = execute("$$#$TBN.Text = $$TX1")
? $VARIABLE1.Text
$_ = execute("$$#$TBN.Text = '2nd-Text'")
? $VARIABLE1.Text
$_ = execute("$$#$TBN.Text = '3rd-Text'")
? $VARIABLE1.Text
;other code
;$VARIABLE1.Text = "3rd-text"
;$_ = execute("$$txt = $$TBN.TEXT")
;$_ = execute("$$txt = $$#$TBN.TEXT")
;$_ = execute("$$#$txt = $$TBN.TEXT")
;$_ = execute("$$#$txt = $$#$TBN.TEXT")
;? "#3=" $txt
;? "#4=" $VARIABLE1.TEXT
$A = len($txt)
? $A
debug off
exit

_________________________
Box
FACTA NON VERBA

Top
#146256 - 2005-08-26 11:36 AM Re: execute () variables not passing when expected.
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
Thank you, I think I might as well forget continuing this...

I simply wanted feed back regarding why when I assign a value to a variable using this structure 'ignoring forms which are incidental to the question' the value was not immediately inumerated and it took two cycles for it to appear in the variable. This was not functioning 'code' just a means of watching when values appear in the variables.
I have not posted a full set of code because for the numerious intertwined functions to be meaningful + to demonstrate an intermittant bug would involve several hundred lines of my project. I could not impose that on you all.

My assessment of the issue is when a function is called the value it is expecting to find has not always appeared yet and hence it tries to enumerate a null and falls over.

I will work on other aspects and if a simpler working example presents itself I will use that to try and seek advice and comment !

Thanks all and a close on this for the moment.

Top
#146257 - 2005-08-26 12:18 PM Re: execute () variables not passing when expected.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not so much simpler is needed but proper.
? "#1=" $VARIABLE1.Text
$_ = execute("$$#$TBN.Text = '2nd-Text'")
? "#2=" $VARIABLE1.Text

in your example, there is nothing that really tests anything.
there are many lines that are totally unrelated and thus totally meaningless.

if you can whip together some lines that really focus on the execute and get a buggie boo out of there, I'd gladly read your findings.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.064 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org