Basic Help with Text

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jamie37
Posts: 53
Joined: Sat Dec 19, 2015 1:45 pm

Basic Help with Text

Post by Jamie37 » Fri Mar 25, 2016 1:00 am

Hello,

I cannot get my head around this problem. Basically I have this code below so that when a file is selected from a field, it sets the delimiter to "/" and clears the previous selection. I then press the new selection from another field and it put into the new field after my item delimiter. The problem is that after this I need to also insert "} which finishes the path off for file. However I cannot seem to get what I need to add it to the end after the file selection has been inserted. Below is the code:

Code: Select all

on selectionchanged
   set the itemdelimiter to "/"
   put the hilitedtext of me into gSelectedFile
   put empty into item 6 in fld "Header_files-download"
   put item 1 of gSelectedFile into tSelectedFile
   put tSelectedFile into item 6 in fld "Header_files-download"
   show button "View"
end selectionchanged
This is the text im inserting the new file selection into and need to add the quote and braces to the end:

Code: Select all

{"path":"/apps/h&s app/apps/myapp/THIS TEXT IS CHANGED"}
Hopefully its clear what I mean...

Thanks
Jamie

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Basic Help with Text

Post by Simon » Fri Mar 25, 2016 1:26 am

How about

Code: Select all

 put tSelectedFile & quote & "}" into item 6 in fld "Header_files-download"
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Jamie37
Posts: 53
Joined: Sat Dec 19, 2015 1:45 pm

Re: Basic Help with Text

Post by Jamie37 » Fri Mar 25, 2016 10:53 pm

Ok thank you Simon, that's great. It is now sorted.

Jamie

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”