Table Problem

Discuss GUI programming with the MUI Royale plugin here
Post Reply
ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Table Problem

Post 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
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: Table Problem

Post 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.
ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Re: Table Problem

Post 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... ;-)
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: Table Problem

Post 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.
ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Re: Table Problem

Post by ArtBlink »

Yes,

You know how to desactivated ESC key to quit MuiRoyale application pleaaaaaaaase? lol
ArtBlink
Posts: 484
Joined: Mon Nov 01, 2010 10:37 am
Location: Albert - France
Contact:

Re: Table Problem

Post 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...
Post Reply