Page 1 of 1

RTF not working on PureBasic 6.03 LTS beta 4?

Posted: Tue Aug 15, 2023 1:26 pm
by dcr3
Hi.

RTF not working on PureBasic 6.03 LTS beta 4 on both versions.? :idea:

Re: RTF not working on PureBasic 6.03 LTS beta 4?

Posted: Tue Aug 15, 2023 2:23 pm
by mk-soft
Check this ...
viewtopic.php?t=81402

Re: RTF not working on PureBasic 6.03 LTS beta 4?

Posted: Tue Aug 15, 2023 4:34 pm
by dcr3
mk-soft wrote: Tue Aug 15, 2023 2:23 pm Check this ...
viewtopic.php?t=81402
Ok . But it's still not working. Unless I am doing something wrong, :oops:

Code: Select all

Enumeration Window
  #Window_0
EndEnumeration
Enumeration Gadgets
  #Edit_1
EndEnumeration

Global AppQuit,t$


t$+"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial Black;}{\f1\fnil\fcharset0 Calibri;}}"
t$+"{\colortbl ;\red155\green0\blue211;\red255\green255\blue0;\red255\green0\blue0;}"
t$+"{\*\generator Riched20 10.0.15063}\viewkind4\uc1" 
t$+"\pard\sa200\sl276\slmult1\b\f0\fs24\lang9 Not \cf1\ul Working \cf2\ulnone On\cf1  \cf3 Beta4\b0\f1\fs22\par"
t$+"}"

Declare Open_Window_0(X = 0, Y = 0, Width = 460, Height = 110)

Procedure Open_Window_0(X = 0, Y = 0, Width = 460, Height = 110)
  
  If OpenWindow(#Window_0, X, Y, Width, Height, "RTF Test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
    EditorGadget(#Edit_1, 10, 10, 440, 90)   
  EndIf
  
EndProcedure

Open_Window_0()

SetGadgetText(#Edit_1,t$)
SendMessage_(GadgetID(#Edit_1), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      AppQuit = #True
  EndSelect
Until AppQuit



Re: RTF not working on PureBasic 6.03 LTS beta 4?

Posted: Tue Aug 15, 2023 5:17 pm
by Axolotl
Hi,
you have to send the TextMode before you send the text ...

Code: Select all

Enumeration Window
  #Window_0
EndEnumeration
Enumeration Gadgets
  #Edit_1
EndEnumeration

Global AppQuit,t$


t$+"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial Black;}{\f1\fnil\fcharset0 Calibri;}}"
t$+"{\colortbl ;\red155\green0\blue211;\red255\green255\blue0;\red255\green0\blue0;}"
t$+"{\*\generator Riched20 10.0.15063}\viewkind4\uc1" 
t$+"\pard\sa200\sl276\slmult1\b\f0\fs24\lang9 Not \cf1\ul Working \cf2\ulnone On\cf1  \cf3 Beta4\b0\f1\fs22\par"
t$+"}"

Declare Open_Window_0(X = 0, Y = 0, Width = 460, Height = 110)

Procedure Open_Window_0(X = 0, Y = 0, Width = 460, Height = 110)
  
  If OpenWindow(#Window_0, X, Y, Width, Height, "RTF Test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
    EditorGadget(#Edit_1, 10, 10, 440, 90)   
  EndIf
  
EndProcedure

Open_Window_0()

SendMessage_(GadgetID(#Edit_1), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)	; first command 
SetGadgetText(#Edit_1,t$)													; second  

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      AppQuit = #True
  EndSelect
Until AppQuit


... or maybe better, put it directly after EditorGadget()

like this

Code: Select all

; ... 
  If OpenWindow(#Window_0, X, Y, Width, Height, "RTF Test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
    if EditorGadget(#Edit_1, 10, 10, 440, 90)   
    	SendMessage_(GadgetID(#Edit_1), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
    EndIf 
  EndIf
; ...

Re: RTF not working on PureBasic 6.03 LTS beta 4?

Posted: Tue Aug 15, 2023 9:04 pm
by dcr3
Axolotl wrote: Tue Aug 15, 2023 5:17 pm you have to send the TextMode before you send the text ...
Ok. Thank you. :oops:

I initially was trying to open a RTF file onto the EditorGadget, but couldn't figure out why it wasn't working.