Page 1 of 1

Table Problem

Posted: Sun Nov 22, 2015 6:05 pm
by ArtBlink
Hello,

I use table for different variable

But, when i initilise it in the start of code like this:

Code: Select all

CheminScript={}
For local X=0 to 100
CheminScript[X]="Ram:"
Next
When i want to pick the data like this :

Code: Select all

If msg.id = "BP4"
						; *** Exécuter un fichier Hollywood ***
						FichierTemporaire=CheminScript[PageActiver] .. "FichierAEffacer.Hws"
						mui.set("Information","contents","Hollywood:System/Hollywood -debugdevice ::stdout >ram:Execution_outpout "  .. chr(34) ..FichierTemporaire .. chr(34)) 
						If Exists(FichierTemporaire)=true then DeleteFile(FichierTemporaire)
						StringToFile(mui.Get("editeur".. PageActiver, "contents"), FichierTemporaire)
						Execute("Hollywood:System/Hollywood -debugdevice ::stdout >ram:Execution_outpout " .. chr(34) ..FichierTemporaire .. chr(34))
						DeleteFile(FichierTemporaire)						
					EndIf  
This line :

Code: Select all

FichierTemporaire=CheminScript[PageActiver] .. "FichierAEffacer.Hws"
Give me an error that CheminScript[1] isn't initialised!!??!!??

Why please?

Thanks

Re: Table Problem

Posted: Sun Nov 22, 2015 9:02 pm
by Bugala
Cant find fault in these lines of code, hence i suspect problem is somewhere else in your code.

I can only suggest putting "debugprint(CheminScript[1])" all around the codes execution to find out at what point does the content disappear from that location.

Re: Table Problem

Posted: Sun Nov 22, 2015 9:16 pm
by ArtBlink
Thanks Bugala, but i found the solution ;-)

I explain with this small code :

Code: Select all

PageActiver=mui.DoMethod("register", "getpageid", "active")
PageActiver=ReplaceStr(PageActiver,"page","")
PageActiver=ToNumber(PageActiver)
PageActiver get the id of page that is activate and the id is for example : Page1
So, i want to use the number of the id to use for index table

Code: Select all

FichierTemporaire=CheminScript[PageActiver] .. "FichierAEffacer.Hws"
I replace Page by nothing and the PageActiver=1

BUT

PageActiver IS a String not a number, so i must convert it

Grrrr 4 hours of research... ouf... ;-)

Re: Table Problem

Posted: Sun Nov 22, 2015 9:24 pm
by Bugala
you mean it wasnt looking for location [1], but ["1"]?

Didnt even think that would be possible. What a nasty bug there, have to keep in mind to not make the same mistake.

Re: Table Problem

Posted: Sun Nov 22, 2015 9:53 pm
by ArtBlink
Yes,

You know how to desactivated ESC key to quit MuiRoyale application pleaaaaaaaase? lol

Re: Table Problem

Posted: Sun Nov 22, 2015 11:00 pm
by ArtBlink
Same problem with this :

Code: Select all

; *** Fichier de Configuration ***
Dim Configuration[30]
Compteur=0
For Ligne$ In FileLines("Config.prefs") 
Configuration[Compteur]=Ligne$
Compteur=Compteur+1
next
For local Compteur=2 to 14
if Configuration[Compteur]="True" 
Configuration[Compteur]=True
else Configuration[Compteur]="False" 
Configuration[Compteur]=False
endif
Next
For integrate result of Configuration[] table in :

Code: Select all

For local Compteur=1 to 13 
mui.Set("CMC" .. Compteur, "Selected", Configuration[Compteur+1])
Next
I must to rewrite table with this after insert line of file in the table

Code: Select all

if Configuration[Compteur]="True" 
Configuration[Compteur]=True
else Configuration[Compteur]="False" 
Configuration[Compteur]=False
endif
To make selected boolean value true or false for checkmark

Strange...