Page 1 of 2

Can You do this?

Posted: Fri May 10, 2024 12:53 pm
by richmond62
An Answer dialogue:
-
baudrons.png
-
And I mean an Answer Dialogue, NOT a fake one with a substack. 8)

Re: Can You do this?

Posted: Fri May 10, 2024 1:40 pm
by Klaus
Yes, I can! :-D
lc_html.png

Re: Can You do this?

Posted: Fri May 10, 2024 1:45 pm
by Klaus
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:

Code: Select all

on mouseUp
   put fld 1 into tAnswer
   answer tAnswer with "Yes" or "No"
end mouseUp
lc_html2.png

Re: Can You do this?

Posted: Fri May 10, 2024 2:32 pm
by dunbarx
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

Re: Can You do this?

Posted: Fri May 10, 2024 2:38 pm
by Klaus
Hi Craig,

the dictionary only states:
...
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.
...
But since LC supports a small subset of html I simply tried this with an image.
Et voila, it works! :-)

Best

Klaus

Re: Can You do this?

Posted: Fri May 10, 2024 4:38 pm
by dunbarx
Klaus.

Terrific detective work and lucky gamble both. I wonder where else this can be exploited.

Craig

Re: Can You do this?

Posted: Fri May 10, 2024 4:39 pm
by dunbarx
HOW COULD THEY NOT mention this somewhere? It would be a fabulous addition to who knows how many LC gadgets.

Craig

Re: Can You do this?

Posted: Fri May 10, 2024 7:19 pm
by stam
dunbarx wrote:
Fri May 10, 2024 4:39 pm
HOW COULD THEY NOT mention this somewhere? It would be a fabulous addition to who knows how many LC gadgets.

Craig
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...

Re: Can You do this?

Posted: Fri May 10, 2024 7:54 pm
by dunbarx
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

Re: Can You do this?

Posted: Fri May 10, 2024 8:45 pm
by Klaus
Craig, this is pure HTML code:

Code: Select all

<p>Do you like this band?</p>
<p><img src="band"></p>
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.

Re: Can You do this?

Posted: Fri May 10, 2024 9:05 pm
by dunbarx
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. :oops:

Craig

Re: Can You do this?

Posted: Fri May 10, 2024 9:06 pm
by dunbarx
This part of the dictionary only makes it worse:
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.
I got as far as "On OS X systems, the image specified in the..."

Craig

Re: Can You do this?

Posted: Sat May 11, 2024 7:15 am
by stam
dunbarx wrote:
Fri May 10, 2024 7:54 pm
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
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?

Re: Can You do this?

Posted: Sat May 11, 2024 7:59 am
by richmond62
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.

Re: Can You do this?

Posted: Sat May 11, 2024 9:38 am
by richmond62
I wonder how far one can 'push' the HTML-code?
-
bunny.png
-
This did not work:
-
Screenshot 2024-05-11 at 11.42.10.png