RTF not working on PureBasic 6.03 LTS beta 4?

Just starting out? Need help? Post your questions and find answers here.
dcr3
Enthusiast
Enthusiast
Posts: 184
Joined: Fri Aug 04, 2017 11:03 pm

RTF not working on PureBasic 6.03 LTS beta 4?

Post by dcr3 »

Hi.

RTF not working on PureBasic 6.03 LTS beta 4 on both versions.? :idea:
User avatar
mk-soft
Always Here
Always Here
Posts: 6252
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post by mk-soft »

Check this ...
viewtopic.php?t=81402
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
dcr3
Enthusiast
Enthusiast
Posts: 184
Joined: Fri Aug 04, 2017 11:03 pm

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

Post 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


Axolotl
Addict
Addict
Posts: 841
Joined: Wed Dec 31, 2008 3:36 pm

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

Post 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
; ...
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
dcr3
Enthusiast
Enthusiast
Posts: 184
Joined: Fri Aug 04, 2017 11:03 pm

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

Post 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.
Post Reply