Can You do this?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Can You do this?
An Answer dialogue:
- -
And I mean an Answer Dialogue, NOT a fake one with a substack.
- -
And I mean an Answer Dialogue, NOT a fake one with a substack.
Re: Can You do this?
Yes, I can!
Re: Can You do this?
The magic word is HTML, and LCs Answer dialog supports this.
See screenshot, the name of my image is "band" and the buttons script is just:
See screenshot, the name of my image is "band" and the buttons script is just:
Code: Select all
on mouseUp
put fld 1 into tAnswer
answer tAnswer with "Yes" or "No"
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can You do this?
Klaus.
Amazing. Where in the dictionary does it say that one can do this sort of magic? What is the form of the command itself?
Craig
Amazing. Where in the dictionary does it say that one can do this sort of magic? What is the form of the command itself?
Craig
Re: Can You do this?
Hi Craig,
the dictionary only states:
Et voila, it works!
Best
Klaus
the dictionary only states:
But since LC supports a small subset of html I simply tried this with an image....
The prompt can be either formatted text (in the property's format) or plain text. If the prompt contains <p> or a start/end tag pair, the answer command assumes the text is in the same format as the property. Otherwise, the answer command assumes the text is plain text.
...
Et voila, it works!
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can You do this?
Klaus.
Terrific detective work and lucky gamble both. I wonder where else this can be exploited.
Craig
Terrific detective work and lucky gamble both. I wonder where else this can be exploited.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can You do this?
HOW COULD THEY NOT mention this somewhere? It would be a fabulous addition to who knows how many LC gadgets.
Craig
Craig
Re: Can You do this?
I'm guessing that by the time you've made the image the right size, positioned everything as you want and then have to keep doing this for every image, you're probably better off designing a substack of your own. And it would probably look a whole lot better since you'd control the layout directly...
Or to put it differently - why is this better than a substack presented as modal?
The coding would be trivial and you wouldn't be constrained by the limits of the answer dialog...
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can You do this?
Stam.
Could not agree more. But where else might it be possible to insert an image where before I (we?) only assumed text could go?
I still have not heard from Klaus on what might be a single line of code that placed that image into the dialog.
Craig
Could not agree more. But where else might it be possible to insert an image where before I (we?) only assumed text could go?
I still have not heard from Klaus on what might be a single line of code that placed that image into the dialog.
Craig
Re: Can You do this?
Craig, this is pure HTML code:
See the second line, which refers to the image on the current card named "band"
and this is the html tag which does the magic: <img src="band">
I was also very surprised that this actually works.
On the other hand, <img src... is a VERY basic html tag.
Code: Select all
<p>Do you like this band?</p>
<p><img src="band"></p>
and this is the html tag which does the magic: <img src="band">
I was also very surprised that this actually works.
On the other hand, <img src... is a VERY basic html tag.
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can You do this?
Klaus.
Recall I am only a beginner.
How do you use that to invoke an answer dialog with an image? I tried several ways with my own resident image, and nothing works.
Craig
Recall I am only a beginner.
How do you use that to invoke an answer dialog with an image? I tried several ways with my own resident image, and nothing works.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can You do this?
This part of the dictionary only makes it worse:
Craig
I got as far as "On OS X systems, the image specified in the..."On OS X systems, the image specified in the gRevAppIcon variable appears as the application icon in the answer dialog box (unless the answer...as sheet form is used). If you specify an iconType, the image specified in the gRevSmallAppIcon variable is used instead, along with the special icon specified by the iconType.
Craig
Re: Can You do this?
I know what you mean, but in my mind just because you can doesn’t mean you should
I have certainly used basic html in answer dialogs for styling… I’ll admit it never occurred to me to add an image tag, because that would be highly atypical for such a dialog, so I never felt the need to test it.
If I need to present an image dialog with custom image(s) to the user I’ll just substack it so I have full layout control.
Perhaps Richmond can elaborate on the point of this?
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Can You do this?
Richmond had drunk 4 glasses of strong red wine and his mind was wandering.
However, the 'problem' about using a substack as an answer palette is that it can get obscured by other substacks unless one is very careful.
In my Devawriter I use images in the main stack and set the visible when they are needed: the snag about this is that one needs one of these images on every card where you might want them displayed.
Certainly:
1. An Answer/Ask palette without an IDE logo is, as far as I'm concerned a big plus.
2. An Answer/Ask palette with a bespoke logo is, as far as I'm concerned a big plus.
3. The logical extension of #2 is an image or a set of images.
Klaus's solution is, like the vast majority of Klaus's solutions, really marvellous.
However, the 'problem' about using a substack as an answer palette is that it can get obscured by other substacks unless one is very careful.
In my Devawriter I use images in the main stack and set the visible when they are needed: the snag about this is that one needs one of these images on every card where you might want them displayed.
Certainly:
1. An Answer/Ask palette without an IDE logo is, as far as I'm concerned a big plus.
2. An Answer/Ask palette with a bespoke logo is, as far as I'm concerned a big plus.
3. The logical extension of #2 is an image or a set of images.
Klaus's solution is, like the vast majority of Klaus's solutions, really marvellous.
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Can You do this?
I wonder how far one can 'push' the HTML-code?
- -
This did not work:
-
- -
This did not work:
-