Images in Editor gadgets!

Share your advanced PureBasic knowledge/code with the community.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

rsts wrote:Thanks for the code.

Is it supposed to be repeated?

cheers
Uhm, absolutely... :oops:

Fixed!
I may look like a mule, but I'm not a complete ass.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

:lol:
Dare2 cut down to size
pfoo
New User
New User
Posts: 7
Joined: Thu May 25, 2006 3:00 pm

Post by pfoo »

Hey, very good job :D
Is it possible to add text on the left or on the righ of the image ?

Apparently,

Code: Select all

SetGadgetText(0,a$+"test")
SetGadgetText(1,a$+"test")
don't work, but it's possible to write manualy beside images ...
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Depends on what you mean?

You can certainly add some text, then insert an image - all in code. Either by using the clipboard, inserting rtf directly or by streaming etc.
I may look like a mule, but I'm not a complete ass.
pfoo
New User
New User
Posts: 7
Joined: Thu May 25, 2006 3:00 pm

Post by pfoo »

What i mean is putting text and image on the same line.
For example :
Blah blah blah (image) blah blah blah
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Yes, although alignment is a problem where images are concerned. Anything you can do by typing directly into an editor gadget can be done in code.

Best bet is probably to use the clipboard, at least in the first instance.

See dare's post above for one way of using the clipboard.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Bug fix: 30th August 2006.

:oops:

Due to my very sketchy understanding of COM etc. Again involving the reference counting.

Code is in the first post.
I may look like a mule, but I'm not a complete ass.
PHP
User
User
Posts: 65
Joined: Sat Sep 10, 2005 5:38 pm

Post by PHP »

Hello,

what's the fastest way to include small bmp-pictures (32x32 pixel) into the EditorGadget()?

If possible without using the clipboard... just convert the bmp so i can use them in the Data-area...
PHP
User
User
Posts: 65
Joined: Sat Sep 10, 2005 5:38 pm

Post by PHP »

Okay i found a way to convert the .bmp to .rtf and included it into the source.

My problem: The image is not shown in the original size but 2x times bigger or something :-(

Does anyone know how to fix that? It's nice to include pictures into the EditorGadget() but if they are not shown in original size it's bad...
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Save it in rtf format, e.g. copy into Wordpad and then save.

Then use CatchRtf() or LoadRtf() etc.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Are you converting to rtf using PB code or using another program?
I may look like a mule, but I'm not a complete ass.
PHP
User
User
Posts: 65
Joined: Sat Sep 10, 2005 5:38 pm

Post by PHP »

1) creating the picture in Paint Shop Pro
2) save in .wmf
3) paste into WordPad
4) save as .rtf
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I use a similar method except I create it in word (simple diagrams), copy into Wordpad and then save etc. I let wordpad handle the conversion to wmf etc.
I may look like a mule, but I'm not a complete ass.
PHP
User
User
Posts: 65
Joined: Sat Sep 10, 2005 5:38 pm

Post by PHP »

This works of course, but the image is not in the same size as in WordPad :-(

Just try with a small (typical) 16x16 Smiley...
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Works fine here php.

I just copied the smiley of yours into wordpad. Saved it and then loaded it into an editor gadget. Exactly the same size!
I may look like a mule, but I'm not a complete ass.
Post Reply