rich text editor examples?

Just starting out? Need help? Post your questions and find answers here.
hagibaba
Enthusiast
Enthusiast
Posts: 170
Joined: Fri Mar 05, 2004 2:55 am
Location: UK
Contact:

rich text editor examples?

Post by hagibaba »

Hi, I'm stuck.

Are there any code examples of how to create a rich text editor inside a scroll area, inside a splitter gadget with a listviewgadget to the right side. I've got some of my old code converted to PB 4 but now it's just driving me nuts and I want to start from scratch... I hope you understood that. Thanks.
hagibaba
Enthusiast
Enthusiast
Posts: 170
Joined: Fri Mar 05, 2004 2:55 am
Location: UK
Contact:

Post by hagibaba »

Never mind, I'll figure it out myself. I just had a little panic attack. Damn StickyWindow command.
hagibaba
Enthusiast
Enthusiast
Posts: 170
Joined: Fri Mar 05, 2004 2:55 am
Location: UK
Contact:

Post by hagibaba »

Ok, here's a sane question... or is it?

How can I put a Win32 richedit window into a splitter gadget?

Code: Select all

  If OpenWindow(0, 0, 0, 230, 180, "SplitterGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(0))
      
      #ListViewGadget  = 1 
      #Splitter = 2
      
      RichEditGadget = CreateWindowEx_(#WS_EX_WINDOWEDGE,"RichEdit20A",0,#Flags, 0, 0, 0, 0, WindowID(0), #GADGET_RICHTEXT, GetModuleHandle_(0), 0)
      ListViewGadget(#ListViewGadget, 10, 10, 250, 120)
      SplitterGadget(#Splitter, 5, 5, 220, 120, RichEditGadget, #ListViewGadget, #PB_Splitter_Separator)
            
      Repeat 
      Until WaitWindowEvent() = #PB_Event_CloseWindow
    EndIf
  EndIf
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

I think your problem may have to do with HOW you created your rich edit gadget...

Though I can'tt see why you would want to do this. :)

Code: Select all

Enumeration
 #ListViewGadget0
 #ListViewGadget1
 #Splitter
EndEnumeration

If OpenWindow(0, 0, 0, 230, 180, "SplitterGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(0))
          
      ListViewGadget(#ListViewGadget0, 0, 0, 0, 0) 
      ListViewGadget(#ListViewGadget1, 0, 0, 0, 0) 
      SplitterGadget(#Splitter, 5, 5, 220, 120, #ListViewGadget0, #ListViewGadget1, #PB_Splitter_Separator)
            
      TextGadget(3, 10, 135, 210, 40, "Above GUI part shows two automatically resizing buttons inside the 230x130 SplitterGadget area.",#PB_Text_Center )
      
      Repeat 
      Until WaitWindowEvent() = #PB_Event_CloseWindow
    EndIf
  EndIf
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Why not use PB's EditorGadget in place of API RichEdit20A?
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Yes, I use a PB editor gadget in a splitter and everything seems to work fine.

cheers
hagibaba
Enthusiast
Enthusiast
Posts: 170
Joined: Fri Mar 05, 2004 2:55 am
Location: UK
Contact:

Post by hagibaba »

I don't know much about the editor gadget. The help file doesn't even say it's a rich text gadget. Where can I find out more about the editor gadget? Is there a limit to how much text it can contain? I use the RichEdit dll for 2 reasons:
1. All the old code is written for the RichEdit window.
2. I know it opens very large text files, several MBs.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

hagibaba wrote:I don't know much about the editor gadget. The help file doesn't even say it's a rich text gadget.
PB's EditorGadget is a RichEdit control on Windows (class = "RichEdit20A" here on NT4).
So you can use any code written for RicheEdit controls, with #EM_* messages, #EN_* notifications, etc...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Large files should not be a problem as long as you extend the default 32,767 text limit with

Code: Select all

SendMessage_(GadgetID(#EditorGadget), #EM_LIMITTEXT, -1, 0)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Sparkie wrote:Large files should not be a problem as long as you extend the default 32,767 text limit with

Code: Select all

SendMessage_(GadgetID(#EditorGadget), #EM_LIMITTEXT, -1, 0)
Mighty nice to know.

Thanks.

cheers
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

You're welcome. I don't remember who I picked that one up from... most likely it was freak. 8)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
hagibaba
Enthusiast
Enthusiast
Posts: 170
Joined: Fri Mar 05, 2004 2:55 am
Location: UK
Contact:

Post by hagibaba »

gnozal wrote: PB's EditorGadget is a RichEdit control on Windows (class = "RichEdit20A" here on NT4).
So you can use any code written for RicheEdit controls, with #EM_* messages, #EN_* notifications, etc...
Yay! This is what I was hoping. Thanks gnozal.

Thanks for the tip Sparkie.

I'm now rewriting the program to use the EditorGadget.
Post Reply