Images in Editor gadgets!

Share your advanced PureBasic knowledge/code with the community.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Any ideal uses for this though?

I've always wished the PureBasic editor could have embedded images,
because it'd make it easier to navigate a large source code. I could have
a nice "MAIN" logo before my main loop, etc. Instead of just text, text, text!
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Have updated the code (now listed in post 1) by adding 3 functions:
  • CatchRTF()
  • LoadRTF()
  • SaveRTF()
Have also updated the examples (post 2) to illustrate these functions.

Regards.
I may look like a mule, but I'm not a complete ass.
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Post by Nico »

How to hide the text below the image?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

What text?
I may look like a mule, but I'm not a complete ass.
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Post by Nico »

Here, a drag'n drop:

Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Bugger me, I didn't realise you could do that with an OLE enabled rich edit! :lol:

I'll have a rummage through the interface specs and see if I can find anything!
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 »

I can prevent the drop easily enough, but when dropping files in this way, the contents are not converted to rtf format, but are simply dumped into memory and linked accordingly. For example, drag a powerpoint presentation and you end up with a graphic saying "Microsoft Powerpoint..." etc. However, open up a powerpoint presentation, select all, copy and then paste into an OLE enabled editor gadget and you get a visual image which, when double clicked, calls up MS Powerpoint for in place editing etc. It's pretty neat, but doesn't really answer your question as I suspect that it is not easily possible.

My suspicion is that you will need to intercept the drop, open the file yourself and somehow stream the contents whilst converting to rtf format yourself!

I'll keep searching however. :D
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 »

Small update to the functions CatchRTF() and LoadRTF(), both of which offer an optional parameter to replace the current selection only or the entire contents of the editor gadget etc.
I may look like a mule, but I'm not a complete ass.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

is there any way to split the editorgadget into columns? A bit like a shopping list.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I don't think so, at least not in the way that MS word does for example.

You might be able to fudge something with tabstops however. :)
I may look like a mule, but I'm not a complete ass.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

srod wrote:Bugger me, I didn't realise you could do that with an OLE enabled rich edit! :lol:
lol :D


I have got absolutely nowhere with aligning text and images. Any success with this? (If so, then that would probably make you one of a handful on the planet!)
@}--`--,-- A rose by any other name ..
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Dare2 wrote:I have got absolutely nowhere with aligning text and images. Any success with this? (If so, then that would probably make you one of a handful on the planet!)
I haven't had time to look yet. My current project (my first commercial whopper!) is approaching the point where I require the ole features of a rich edit (which was the motivation in my investigating embedding images etc.) and so it will not be long now.

However, I suspect my requirements are not as specific as yours. My alignment issues can be solved with a few strategically placed tabs and margin alignment etc.

btw, there's a small bug in the above code. I've fixed it, but will not upload anew until I've extended the code so that it can handle more than one editor gadget at a time. It's a small issue. The new version should not break existing code however.
I may look like a mule, but I'm not a complete ass.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

srod wrote:my first commercial whopper!
Heya! Success to you! :D That sounds great!
@}--`--,-- A rose by any other name ..
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Code updated and various problems fixed with reference counting.

Example 1 updated to include multiple editor gadgets.
I may look like a mule, but I'm not a complete ass.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Thanks for the code.

Is it supposed to be repeated?

cheers
Post Reply