Page 1 of 2

Saving datas with RapaGUI

Posted: Mon May 01, 2017 11:46 pm
by Pierre55
Hi,

I'm looking the way to save datas like in the demo "dialogs" in Rapagui plugin.

Hope this is possible.

Thank you.

Pierre.

Re: Saving datas with RapaGUI

Posted: Tue May 02, 2017 9:40 pm
by airsoftsoftwair
Please describe in more detail what you want to do. The question is currently too general...

Re: Saving datas with RapaGUI

Posted: Tue May 02, 2017 11:44 pm
by Pierre55
Hi,

I want to add the LOADING and SAVING function into the DIALOGS demo program wich came with RapaGUI plugin.

I add the OPEN, SAVE and SAVE_AS in the pulldown menu but can't figure what I shoud do to open or save the data I enter.

I tryed different version of: StringToFile(What should I wrote here?), projectname$)

Thank you.

Re: Saving datas with RapaGUI

Posted: Tue May 02, 2017 11:54 pm
by airsoftsoftwair
Pierre55 wrote:StringToFile(What should I wrote here?), projectname$)
Depends on what you want to write to the file. If you want to write "Hello" to the file, you use:

Code: Select all

StringToFile("Hello", "test.txt")
This will create a new file named "test.txt" in the current directory and write "Hello" into it. File size will be 5 bytes.

Re: Saving datas with RapaGUI

Posted: Wed May 03, 2017 1:26 am
by Pierre55
Hi,

You need to RUN the DIALOGS demo in RapaGui to understand that I want to save all the datas you input.

Thanks

Re: Saving datas with RapaGUI

Posted: Wed May 03, 2017 1:48 pm
by Pierre55
Hi,

Here it's the line that "editor" saved the text;

StringToFile(moai.Get("editor", "text"), projectname$)

Is there something like this I can use to save the datas in Dialogs ?

Thank you.

Re: Saving datas with RapaGUI

Posted: Sun May 07, 2017 5:40 pm
by airsoftsoftwair
Sure, you need to use Listview.GetEntry to iterate over all items in the listview and then save them to a text file, e.g. something like this (not tested, from the top of my head):

Code: Select all

OpenFile(1, "output.txt", #MODE_WRITE)
For Local k = 0 To moai.Get("lv", "entries")-1
    Local t$ = moai.DoMethod("lv", "getentry", k)
    WriteLine(1, t$)
Next
CloseFile(1)

Re: Saving datas with RapaGUI

Posted: Sun May 07, 2017 11:10 pm
by Pierre55
Thank you for the info but I have two problems, there is an error when I run the program "Unexpected symbol!" current line 187.

The second problem it's Hollywood that give the error at the wrong line because there is nothing at line 187.
It seems that the line reported is always +1.

So the error is on the line that said:
WriteLine(1, t$)

Bye!

Re: Saving datas with RapaGUI

Posted: Mon May 08, 2017 9:03 pm
by airsoftsoftwair
Well, it's hard to tell without seeing the complete script. So please post the script here and I'll check...

Re: Saving datas with RapaGUI

Posted: Wed May 10, 2017 2:46 am
by Pierre55
Hi,

First I would like to tell you that I really appreciate your help!

I finally found (with a lot of your help) the way to save the file in CSV format:

Function p_Save()
OpenFile(1, projectname$, #MODE_WRITE)
For Local k = 0 To moai.Get("lv", "entries") -1
Local state, item$, Nom$, Tjrs1$, Prix$, Exp$ = moai.DoMethod("lv", "getentry", k)
Local t$ = item$ .. "," .. Nom$ .. "," .. Prix$ .. "," .. Exp$
WriteLine(1, t$)
Next
CloseFile(1)
EndFunction

Now my next question: How can I do to LOAD the file in dialog window?

Thanks.