TextEdit Gadget
TextEdit Gadget
My latest experiments with the canvas gadget
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
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.
Re: TextEdit Gadget
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/viewtopi ... 53#p269553 ?
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/viewtopi ... 53#p269553 ?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: TextEdit Gadget
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!
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!
-
- Enthusiast
- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: TextEdit Gadget
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
Anyhow, thats all up to you but thanks for the good stuff. I am impressed..
J
Would be nice if you would decide to share the code
Anyhow, thats all up to you but thanks for the good stuff. I am impressed..
J
Re: TextEdit Gadget
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
Re: TextEdit Gadget
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 )
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 )
Re: TextEdit Gadget
good work.
but one bug here:
situation:
and after i press two times DEL-key:
the "w" is bold, but why?
but one bug here:
situation:
and after i press two times DEL-key:
the "w" is bold, but why?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: TextEdit Gadget
Thanks for the report! I wrote everything on the Mac, which has no Del key, and didn't test at all on Windows
I'll look into it, mustn't be a big deal
I'll look into it, mustn't be a big deal
Re: TextEdit Gadget
Fixed, wasn't a big deal indeed
I'll post an update soon when I have some more features, already added a new underline formatting, as well as strikethrough and color
I'll post an update soon when I have some more features, already added a new underline formatting, as well as strikethrough and color
Re: TextEdit Gadget
Text formatting is finished
Gonna look into the line wrapping now, the hardest part!
-
- Enthusiast
- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: TextEdit Gadget
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... ?
Re: TextEdit Gadget
Didn't really look into that, but if you find a good file format definition it shouldn't be hard
Re: TextEdit Gadget
I made some really simple (not optimized) code for this, here (take a look on the third example):Polo wrote:Gonna look into the line wrapping now, the hardest part!
http://www.purebasic.fr/english/viewtop ... 12&t=45192
And here is a rather complex code from idle for his TextEditGadget (also using Canvas, don't stop coding yours though!) :
http://www.purebasic.fr/english/viewtop ... 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!
Re: TextEdit Gadget
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
Already 3,000 lines of code
- flaith
- Enthusiast
- Posts: 704
- Joined: Mon Apr 25, 2005 9:28 pm
- Location: $300:20 58 FC 60 - Rennes
- Contact:
Re: TextEdit Gadget
Thanks a lot Polo, definitely this canvas gadget open the way of making a lot of great things
“Fear is a reaction. Courage is a decision.” - WC