Saving datas with RapaGUI

Discuss GUI programming with the RapaGUI plugin here
Pierre55
Posts: 54
Joined: Sat Apr 01, 2017 4:25 pm

Saving datas with RapaGUI

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving datas with RapaGUI

Post by airsoftsoftwair »

Please describe in more detail what you want to do. The question is currently too general...
Pierre55
Posts: 54
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving datas with RapaGUI

Post 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.
Pierre55
Posts: 54
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Post 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
Pierre55
Posts: 54
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving datas with RapaGUI

Post 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)
Pierre55
Posts: 54
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Post 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!
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving datas with RapaGUI

Post by airsoftsoftwair »

Well, it's hard to tell without seeing the complete script. So please post the script here and I'll check...
Pierre55
Posts: 54
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

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