Page 1 of 1

Paste To EditorGadget

Posted: Tue Oct 18, 2011 2:56 am
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.

Re: Paste To EditorGadget

Posted: Tue Oct 18, 2011 4:14 am
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.

Re: Paste To EditorGadget

Posted: Tue Oct 18, 2011 7:33 am
by jesperbrannmark
What you mean? Editorgadget doesnt support formatted text (RTF or HTML)... no bold, italics, fontsize, colors etc...

Re: Paste To EditorGadget

Posted: Tue Oct 18, 2011 12:02 pm
by IdeasVacuum
...yes, it does support RTF on Windows. There are a lot of posts about that, look for Rich Edit.

Re: Paste To EditorGadget

Posted: Tue Oct 18, 2011 6:11 pm
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


Re: Paste To EditorGadget

Posted: Wed Oct 19, 2011 3:40 am
by electrochrisso
Thanks RASHAD, just what I need. :D