forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Newbi Question About Edit Element
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Tue Dec 16, 2008 6:25 pm    Post subject: Newbi Question About Edit Element Reply with quote

Hi,
From the looks of things here either this fourm is dead or VDS is dead. However, I still like this program after playing with it. I need some help on doing this if anyone is around who can give me some help.

I am trying to create something really simple but not for me so it seems.
I just want to create a business form using VDS 5. It will simply have about 10 edit boxes and a Company logo on it.

1)I have created the visual dialog box with the edit boxes and the text logo. But I can not seem to figure out how to code it. I just want to have the customer or user input the their text like there name and address into the edit boxes and than there text input just needs to be saved to a text file. So how do I save to a text file. What code would work for this simple operation?

2) Than I want to be able to read that text file again in another vds dialoge and display it on the screen in a list box. So how do I read from the text file?

Thanks for any help that anyone can give a newbie with VDS.

Starfire from Florida
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Dec 16, 2008 8:40 pm    Post subject: Re: Newbi Question About Edit Element Reply with quote

starfire wrote:
Hi,
From the looks of things here either this fourm is dead or VDS is dead. However, I still like this program after playing with it. I need some help on doing this if anyone is around who can give me some help.

I am trying to create something really simple but not for me so it seems.
I just want to create a business form using VDS 5. It will simply have about 10 edit boxes and a Company logo on it.

1)I have created the visual dialog box with the edit boxes and the text logo. But I can not seem to figure out how to code it. I just want to have the customer or user input the their text like there name and address into the edit boxes and than there text input just needs to be saved to a text file. So how do I save to a text file. What code would work for this simple operation?

2) Than I want to be able to read that text file again in another vds dialoge and display it on the screen in a list box. So how do I read from the text file?

Thanks for any help that anyone can give a newbie with VDS.

Starfire from Florida


Greetings Starfire,

You would create a list, not a list element, but just a LIST

LIST CREATE,1

And then, you can add the data from each edit box like

LIST ADD,1,@dlgtext(EDIT1)

the @dlgtext() function you need to put the dialog name of an edit box in the brackets, I used EDIT1 only as an example. So if you had like 5 edit boxes, it would look like this

LIST ADD,1,@dlgtext(EDIT1)
LIST ADD,1,@dlgtext(EDIT2)
LIST ADD,1,@dlgtext(EDIT3)
LIST ADD,1,@dlgtext(EDIT4)
LIST ADD,1,@dlgtext(EDIT5)

Then to save the list you would

LIST SAVEFILE,1,<path and file name here>

so for example purposes, I'll make a fake path and file name

LIST SAVEFILE,1,c:\program files\my program\savedtext.txt

And that's it.

All of this is covered in the help file too. You just need to take the time to browse and read it.

To get that text back again in another vds made program,

LIST CREATE,1
LIST LOADFILE,1,c:\program files\my program\savedtext.txt

So as to not just write the whole program for you, I'm going to stop there and let you now do the research to finish this.

You need to look up @next() and @item() to get data from any single line from the list. Or use @text() to get the entire contents of the list.

Also, there is a wealth of examples on the main site here which would've easily shown you what you needed. So browse around the main site in the examples section, download some, look at them.

Best regards,
~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Dec 16, 2008 8:58 pm    Post subject: Reply with quote

Hey... Hopefully this will help you out some. It's been awhile since I've used VDS so what I wrote may not be the most efficient code, but it should work for your purposes.

Code:
Title Edit Box Example
  # path of the data file
  %%filepath = @path(%0)edit_box_example_data.txt
  DIALOG CREATE,Edit Box Example,-1,0,276,128
  DIALOG ADD,TEXT,Edit1Label,16,16,,,Edit Box #1:
  DIALOG ADD,TEXT,Edit2Label,48,16,,,Edit Box #2:
  DIALOG ADD,EDIT,Edit1,16,80,176,20,Default Text for Edit1
  DIALOG ADD,EDIT,Edit2,48,80,176,20,Default Text for Edit2
  DIALOG ADD,BUTTON,Save,88,16,104,24,&Save to Text File,,DEFAULT
  DIALOG ADD,BUTTON,Read,88,128,128,24,&Read Current Data File
  DIALOG SHOW
:Evloop
  wait event
  goto @event()
:SaveBUTTON
  # prepares the string to save to the file
  %%data = @dlgtext(Edit1)|@dlgtext(Edit2)
  info The following data will be saved to a text file with each field delimited by a pipe character:@cr()@cr()%%data
  list create,1
  list add,1,%%data
  list savefile,1,%%filepath
  list close,1
  info The file has been saved in the following location:@cr()%%filepath
  goto evloop
:ReadBUTTON
  # check to see that data file exists
  if @not(@file(%%filepath))
    warn No data file currently saved.
    goto Evloop
  end
  # parse the data file, using the pipe character as the delimiter
  list create,2
  list loadfile,2,%%filepath
  PARSE "%%edit1;%%edit2",@item(2,0)
  list close,2
  info The following data was saved in the file:@cr()Edit 1 Data: %%edit1@cr()Edit 2 Data: %%edit2
  goto Evloop
:Close
  exit


The example only roughly implements reading the contents of the data file. To re-assign the contents to edit boxes, try using DIALOG SET,Edit1,%%edit1

You'll be able to get the hang of it if you play with the example a bit.

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Tue Dec 16, 2008 10:17 pm    Post subject: Reply with quote

Thank you Garrett and FreezingFire. It still looks complicated for a newbie like me but some of it does make sense. I will study and see what I can understand. Thank you both of you for responding back to me with some great answers and information. I most likely will be back with several followup questions for both of you. I hope you do not mind if I come back with another question or two until I get it.
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Dec 17, 2008 3:56 am    Post subject: Reply with quote

Sure thing... don't worry about asking questions, we're more than happy to help. Smile
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Wed Dec 17, 2008 4:43 am    Post subject: Reply with quote

Ok, I now see and have been able to make my form page customer input go to a text file. This so cool!..Sorry I do get a little excited about this stuff.
Anyway, now I am trying to get the information that was saved by the customer, that is now in the text file to be read back into the form again.
1)From form page input to text file done and works. Life is good.

2) Trying to get the text file data back into the form page now. In proper order of course. This is where I have been lost for hours and hours...I need some more help please. It needs to be place exactly back into the same edit boxes. Is this possible? What should I do?
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Dec 17, 2008 7:30 am    Post subject: Reply with quote

starfire wrote:
Ok, I now see and have been able to make my form page customer input go to a text file. This so cool!..Sorry I do get a little excited about this stuff.
Anyway, now I am trying to get the information that was saved by the customer, that is now in the text file to be read back into the form again.
1)From form page input to text file done and works. Life is good.

2) Trying to get the text file data back into the form page now. In proper order of course. This is where I have been lost for hours and hours...I need some more help please. It needs to be place exactly back into the same edit boxes. Is this possible? What should I do?


You can do it almost the same way you saved it out.

Since you already know what order you saved the file, now you can read it back in, in the same order

LIST CREATE,1
LIST LOADFILE,1,c:\program files\my program\savedtext.txt
DIALOG SET,EDIT1,@item(1,0)
DIALOG SET,EDIT2,@item(1,1)
DIALOG SET,EDIT3,@item(1,2)
DIALOG SET,EDIT4,@item(1,3)

The @item(,) you see is where you are getting the info from the list you loaded, which I showed you in my previous reply.

The first part of @item(1,) is the list number,

LIST CREATE,1 <--- that's the list number.

The second part of the @item(1,0) is the line number of the list. Take note though, that list start at line 0 and not line 1. That might throw some confusion at you some times.

So @item(1,3) will get you data from LIST1, at line 4 (which is really the 4th line, but remember lines start at 0 in lists.)

I hope that helps you on your next stage there. And feel free to ask questions, you'll get some sort of answer from someone here Smile

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Dec 17, 2008 7:53 am    Post subject: Reply with quote

Yes, follow Garrett's direction on reading the data back in--the way I wrote my
example was a bit overcomplicated.

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Wed Dec 17, 2008 9:15 pm    Post subject: Reply with quote

Another simple question:

How do you get comma's to show up in the address to work here?
I have tried ',' but it did not work.

DIALOG ADD,EDIT,EDIT10,320,408,592,24,PO Box 2333 Mansfield, OH 12345-2596,,STYLE10
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Wed Dec 17, 2008 11:13 pm    Post subject: Reply with quote

Use double quotes... ","

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Wed Dec 17, 2008 11:26 pm    Post subject: Reply with quote

Thanks Hooligan that did the trick. I am still in the learning stage.
Back to top
View user's profile Send private message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Sat Dec 20, 2008 2:37 pm    Post subject: Reply with quote

Garrett or anyone tell me what is going on here. When I use the script down below as suggested by Garrett it works but only once. When I hit my reload button again it turns around tells me "invalid list operation". If I exit and than try it again it works once and than gives me the same error again. I am missing something here. Must be something simple I am sure.

I am just a newbi trying to figure this out. Thanks in advance for anyhelp anyone can give me.

And thanks for helping out on this Garrett.





LIST CREATE,1
LIST LOADFILE,1,c:\program files\my program\savedtext.txt
DIALOG SET,EDIT1,@item(1,0)
DIALOG SET,EDIT2,@item(1,1)
DIALOG SET,EDIT3,@item(1,2)
DIALOG SET,EDIT4,@item(1,3)
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Sat Dec 20, 2008 3:35 pm    Post subject: Reply with quote

It is trying to create a list that already exists... The "list create" command should only be called once, (unless you delete it). You may want to clear it so that you don't have duplicated entries...

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Sat Dec 20, 2008 4:23 pm    Post subject: Reply with quote

Thanks Hooligan,

I am beginning to see some more daylight. What I need to do is
create list 1 and load file at the beginning. Than clear list 1 and than create list 2.

Does this sound right?
Back to top
View user's profile Send private message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Sat Dec 20, 2008 5:43 pm    Post subject: Reply with quote

Ok now I have list create part working almost. Getting there.

Last edited by starfire on Sat Dec 20, 2008 10:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group