It is currently Mon May 25, 2020 11:58 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 57 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: TextEdit Gadget
PostPosted: Fri Sep 16, 2011 11:20 am 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
My latest experiments with the canvas gadget :)

Image

This is the equivalent of an Editor Gadget, although this is a canvas. At the moment it provides nothing more than the Editor Gadget, and nothing less I hope (except line wrap maybe, not even sure this is natively supported). Everything is drawn and controlled through PB command set :)

My plans are to add optional line wrap, then text formatting, then other features (live scrollbars, inline pictures etc?)
As this is a canvas, everything is crossplaform!

Give it a try! In the file you'll find the MacOSX and Windows executables. I must say I developped this on the Mac, didn't really test the Windows version though it seems to work fine.
Try as well the keyboard shortcuts like alt+right and so on to see if i haven't forgotten any :)

http://www.megaupload.com/?d=XQ5NQI3A


Last edited by Polo on Thu Oct 20, 2011 12:13 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Fri Sep 16, 2011 12:56 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1271
Location: Germany, Glienicke
good work!

I love the canvas gadget. After #PB_Canvas_Input was added, I also wrote my own text editor.

In my editor, I can already use styles.
Here I use a kind of RTF format that is read at run time, how will you incorporate styles?

will be able to integrate into your editor mathematical formulas, like this older example from me: http://www.purebasic.fr/german/viewtopic.php?p=269553#p269553 ?

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Fri Sep 16, 2011 2:41 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
Nice one too!
I'll add text formatting the same way I did with my GridGadget, should be too hard thus (not RTF at all though, I did it the way I though was the easiest) :)

Good idea with the maths editor, maybe I'll look into that too!


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sat Sep 17, 2011 9:28 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 536
Location: sweden
I really think you and I have some kind of subconscious connection. I wrote a post about the listicongadget being outdated and maybe the canvasgadget could be the solution.. Next day you posted the gridgadget.... Last night I thought I need to write this to be able to do textedit (with some simple bold, italics, etc etc) on multiplatform. Woke up (my birthday by the way) and here it is.

Would be nice if you would decide to share the code :wink:
Anyhow, thats all up to you but thanks for the good stuff. I am impressed..

J


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sat Sep 17, 2011 11:10 am 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
:mrgreen:
Happy birthday :)

Well I think those kind of gadgets are essential, and the two main OS should be supported :)
I'm working on the text formatting right now, more or less working, encountered the PB text drawing bug when using very large font (on MacOSX the bottom of the text is cut if the font is large), hope it'll get fixed :)

If I'm satisfied with it I'll release it, one way or another!
I really like the math equation idea Stargate showed, as I'm not satisfied with the MS Word one (if you write a fraction it's way too small), I'll try to add something like this too :)


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sat Sep 17, 2011 6:53 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
With text formatting:

http://www.megaupload.com/?d=TINQVLW4

On both platform I shouldn't use the built in underline, as if you have two font sizes used on the same line and both underlined, it won't make a straight underline...
On MacOSX, PB returns incorrect TextWidth and TextHeight, thus my calculation to vertically align the text on a same line is a bit incorrect when there is a big difference in font size.

Other than that, it seems to work fine.
You can try and change the different options :)

Next steps is to correct the underline, implement color formatting, strike through formatting, and then line wrap.

(can't believe how much work it is :mrgreen: )


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sat Sep 17, 2011 8:04 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1271
Location: Germany, Glienicke
good work.

but one bug here:
situation:
Image
and after i press two times DEL-key:
Image

the "w" is bold, but why?

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sat Sep 17, 2011 8:13 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
Thanks for the report! I wrote everything on the Mac, which has no Del key, and didn't test at all on Windows :mrgreen:

I'll look into it, mustn't be a big deal :)


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sat Sep 17, 2011 8:17 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
Fixed, wasn't a big deal indeed :wink:
I'll post an update soon when I have some more features, already added a new underline formatting, as well as strikethrough and color :)


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sun Sep 18, 2011 2:30 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
Image

Text formatting is finished :)
Gonna look into the line wrapping now, the hardest part!


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sun Sep 18, 2011 9:05 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 536
Location: sweden
It reminds me a lot of the richtext control from VB (or gfabasic in my case), a part i really been missing in PB (especially for mac). A question that is a bit more tricky is how to save and load documents... ?


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Sun Sep 18, 2011 9:55 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
Didn't really look into that, but if you find a good file format definition it shouldn't be hard :)


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Mon Sep 19, 2011 9:49 am 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1981
Location: Germany
Polo wrote:
Gonna look into the line wrapping now, the hardest part!
I made some really simple (not optimized) code for this, here (take a look on the third example):
viewtopic.php?f=12&t=45192

And here is a rather complex code from idle for his TextEditGadget (also using Canvas, don't stop coding yours though!) :
viewtopic.php?f=12&t=45669


Btw, do you plan to release your source code? Would be great!. ;)

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Mon Sep 19, 2011 10:47 am 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2422
Location: UK
Thanks c4s, it's quite hard to implement in my gadget as it needs to take into account all formatting etc ;)
Already 3,000 lines of code :oops:


Top
 Profile  
Reply with quote  
 Post subject: Re: TextEdit Gadget
PostPosted: Mon Sep 19, 2011 12:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Apr 25, 2005 9:28 pm
Posts: 703
Location: $300:20 58 FC 60 - Rennes
Thanks a lot Polo, definitely this canvas gadget open the way of making a lot of great things :D

_________________
“Fear is a reaction. Courage is a decision.” - WC


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 57 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye