Dropdown/Option menu embedded in text in field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Dropdown/Option menu embedded in text in field
Hi all
Sorry for over a year of absence!
I have a requirement for some "variable" text within a field. It is to replace the usual "mail merge" function where a variable is put in between special characters, e.g.
%FIRST_NAME%
I am trying to make that more user friendly, so a user can select a choice from a pop-up menu. Then behind the scenes a text is generated with the correct codes embedded, e.g. %FIRST_NAME%, %SURNAME%. Please see screenshot of the idea.
What is the best approach to achieve this in LiveCode? I am sure there will be an elegant way! I thought of imagesource, but I want to embed a live menu if possible.
The next stage after this will be to implement this in HTML. I have no idea what the limitations are there. But I want to create this "prototype" first...
Regards
Kaveh
Sorry for over a year of absence!
I have a requirement for some "variable" text within a field. It is to replace the usual "mail merge" function where a variable is put in between special characters, e.g.
%FIRST_NAME%
I am trying to make that more user friendly, so a user can select a choice from a pop-up menu. Then behind the scenes a text is generated with the correct codes embedded, e.g. %FIRST_NAME%, %SURNAME%. Please see screenshot of the idea.
What is the best approach to achieve this in LiveCode? I am sure there will be an elegant way! I thought of imagesource, but I want to embed a live menu if possible.
The next stage after this will be to implement this in HTML. I have no idea what the limitations are there. But I want to create this "prototype" first...
Regards
Kaveh
Kaveh
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dropdown/Option menu embedded in text in field
Erm, well, at least it's a start.
Re: Dropdown/Option menu embedded in text in field
I *think* your looking for something like this -
Make sure the field the text is in is locked, the transversal can be off or not. The button's "visible" is set to false, the menu will pop up at the location of the mouseLoc without needing to code it specifically. Of course, if you want the menu to overlay the word clicked on, its location can be changed
In your case, you would have to add a menuPick handler as well, most likely.
Make sure the field the text is in is locked, the transversal can be off or not. The button's "visible" is set to false, the menu will pop up at the location of the mouseLoc without needing to code it specifically. Of course, if you want the menu to overlay the word clicked on, its location can be changed
In your case, you would have to add a menuPick handler as well, most likely.
-
- VIP Livecode Opensource Backer
- Posts: 9751
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dropdown/Option menu embedded in text in field
Hi
Try this:
Craig
Try this:
Craig
Re: Dropdown/Option menu embedded in text in field
I'm not kaveh, but I tried it. It was both interesting and confusing heh heh.
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: Dropdown/Option menu embedded in text in field
Thanks to all.
@Richmond – I did not know about linkClicked. Thanks for that
@Bogs - That seems to be the closest approach I need to take. Please note:
I am going to work on this and report back. Thanks as always...
Regards
Kaveh
@Richmond – I did not know about linkClicked. Thanks for that
@Bogs - That seems to be the closest approach I need to take. Please note:
- I need the text to be editable too, so thinking that when the mouse is over the target text, or when cursor in in target text I lock text. Else I unlock it
- I need the replacement text to be visible, so when I select "Surname", then that text should show instead of [link]. Thinking of having a backgroundcolor for target text, so text can change but I know it is the variable text
- I need a hierarchical menu but I remember Craig had an answer to that: viewtopic.php?t=14429
I am going to work on this and report back. Thanks as always...
Regards
Kaveh
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 9751
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dropdown/Option menu embedded in text in field
So, instead of dumping the clickText into a field, which I did just for show, would appending the selection right after the clickChunk do?- I need the variable text elements to behave as text, in that they move around and wrap as the text is edited. Imag
I originally made this with a pullDown, but did not like the fact that the actual button was displayed along with the menuItems. Now it occurs to me that I could have set the blendLevel to hide the "button" portion, thus only displaying the menuItems.
Craig
Re: Dropdown/Option menu embedded in text in field
Hi Kaveh,
I case you didn't know, LC also has a MERGE() function which uses -> [[xxx]] for placeholders.
Field "text with placeholders":
-----------------------------------
Lorem ipsum dolor sit amet, [[first_name]] [[tName]] elitr, sed ...
-----------------------------------
Resolve:
Field 2:
-------------------------------------
Lorem ipsum dolor sit amet, Willie Wonka elitr, sed ...
-------------------------------------
You can also use functions as placeholder and expressions -
-> [[fld "addition1" + fld "addition2"]]
-> [[the label of btn "a button" of cd 56 of stack "another stack"]]
-> [[mycomplicatedfunction(fld "some values")]]
etc.
You get the picture.
Best
Klaus
I case you didn't know, LC also has a MERGE() function which uses -> [[xxx]] for placeholders.
Field "text with placeholders":
-----------------------------------
Lorem ipsum dolor sit amet, [[first_name]] [[tName]] elitr, sed ...
-----------------------------------
Resolve:
Code: Select all
...
put "Willie" into first_name
put "Wonka" into tNname
put merge(fld "text with placeholders") into fld 2
...
-------------------------------------
Lorem ipsum dolor sit amet, Willie Wonka elitr, sed ...
-------------------------------------
You can also use functions as placeholder and expressions -
-> [[fld "addition1" + fld "addition2"]]
-> [[the label of btn "a button" of cd 56 of stack "another stack"]]
-> [[mycomplicatedfunction(fld "some values")]]
etc.
You get the picture.
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: Dropdown/Option menu embedded in text in field
I had no idea of merge() either! Thanks Klaus. My first problem to get the interface sorted, and I am slowly working on that. But good to know easy to merge after and I don't have to use regex.
Unfortunately this has to be reimplemented using PHP and other web tools. I have no idea if that can be done but if I make a prototype it will push my colleagues to find a way...
Unfortunately this has to be reimplemented using PHP and other web tools. I have no idea if that can be done but if I make a prototype it will push my colleagues to find a way...
Kaveh