Paste To EditorGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Paste To EditorGadget

Post by electrochrisso »

Is it possible when pasting to the EditorGadget to not have the rich formatting and be like the StringGadget and stay in the same font originally set for the gadget. I can use StringGadget multiline and extra flags, but I like the EditorGadget better for what I want to use it for.
PureBasic! Purely the best 8)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Paste To EditorGadget

Post by IdeasVacuum »

...Instead of offering the User only a 'Paste' option, you can, say, have two options on the Menu/PopUp - 'Paste' and 'Paste Unformatted'.

If the User selects 'Unformatted', simply paste into a hidden string gadget first, then copy from that (GetGadgetText) into the active Editor gadget.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Re: Paste To EditorGadget

Post by jesperbrannmark »

What you mean? Editorgadget doesnt support formatted text (RTF or HTML)... no bold, italics, fontsize, colors etc...
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Paste To EditorGadget

Post by IdeasVacuum »

...yes, it does support RTF on Windows. There are a lot of posts about that, look for Rich Edit.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Paste To EditorGadget

Post by RASHAD »

You can switch between RTF and Plain Text at any time

Code: Select all


If OpenWindow(0, 0, 0, 400, 290, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  EditorGadget(0, 10,10, 380, 240)
  ButtonGadget(1, 10, 260, 80, 20, "RTF")
  ButtonGadget(2, 100, 260, 80, 20, "Pain Text")
Repeat
  Select WaitWindowEvent()
      
       Case #PB_Event_CloseWindow
          Quit = 1       
     
      Case #PB_Event_Gadget
          Select EventGadget()
           Case 1
               SetGadgetText(0,"")
               SendMessage_(GadgetID(0), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
               SetActiveGadget(0)

           Case 2
               SetGadgetText(0,"")
               SendMessage_(GadgetID(0), #EM_SETTEXTMODE, #TM_PLAINTEXT, 0)
               SetActiveGadget(0)
                        
          EndSelect
  EndSelect
Until Quit = 1

EndIf

Egypt my love
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: Paste To EditorGadget

Post by electrochrisso »

Thanks RASHAD, just what I need. :D
PureBasic! Purely the best 8)
Post Reply