Seite 1 von 1

[gelöst] EditorGadget -> Formatierung funktioniert nicht mehr seit Umstellung auf PB 6.03 LTS

Verfasst: 21.05.2024 22:02
von techniker
Hallo,

Seit dem Umstieg von PB 5.62 auf PB 6.03 LTS funktioniert die Formatierung des EditorGadget unter Windows nicht mehr.
Weiß zufällig jemand, warum? Und kennt ggf. auch einen Workaround?

PB 5.62

Code: Alles auswählen

  CompilerIf Not Defined(CFM_BACKCOLOR, #PB_Constant) 
    #CFM_BACKCOLOR =$4000000 
  CompilerEndIf 


Procedure SetColor(gadget.l, charstart.l, charend.l, fcolor.l, bcolor.l = #White, attrib.l = 0)
    ; attrib: #CFE_BOLD, #CFE_ITALIC, #CFE_UNDERLINE, #CFE_STRIKEOUT
Debug "SetColor("+Str(gadget)+", "+Str(charstart)+", "+Str(charend)+", "+Str(fcolor)+", "+Str(bcolor)+", "+Str(attrib)+")"
    
    Protected cf.charformat2\cbSize = SizeOf(charformat2)
    Protected sel.CHARRANGE
    
    SendMessage_(GadgetID(gadget), #EM_EXGETSEL, 0, sel)
    cf\dwMask = #CFM_COLOR|#CFM_BACKCOLOR|#CFM_BOLD|#CFM_ITALIC|#CFM_UNDERLINE|#CFM_STRIKEOUT
    cf\dwEffects = attrib
    cf\crTextColor = fcolor
    cf\crBackColor = bcolor
    SendMessage_(GadgetID(gadget), #EM_SETSEL, charstart, charend)
    SendMessage_(GadgetID(gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, @cf)
    SendMessage_(GadgetID(gadget), #EM_SETSEL, sel\cpMin, sel\cpMax)
  EndProcedure
  
#editor = 100
  
If OpenWindow(0, 100, 200, 500, 500, "PB 5.62 (x86)", #PB_Window_SystemMenu)

  EditorGadget(#editor, 10, 10, 300, 25)
  SetGadgetText(#editor, "Dies ist ein Testtext")
  SetColor(#editor, 3, 12, #Red, #Black, #CFM_BOLD)
  
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf
Ergebnis:
Bild

PB 6.03 LTS:

Code: Alles auswählen

  CompilerIf Not Defined(CFM_BACKCOLOR, #PB_Constant) 
    #CFM_BACKCOLOR =$4000000 
  CompilerEndIf 


Procedure SetColor(gadget.l, charstart.l, charend.l, fcolor.l, bcolor.l = #White, attrib.l = 0)
    ; attrib: #CFE_BOLD, #CFE_ITALIC, #CFE_UNDERLINE, #CFE_STRIKEOUT
Debug "SetColor("+Str(gadget)+", "+Str(charstart)+", "+Str(charend)+", "+Str(fcolor)+", "+Str(bcolor)+", "+Str(attrib)+")"
    
    Protected cf.charformat2\cbSize = SizeOf(charformat2)
    Protected sel.CHARRANGE
    
    SendMessage_(GadgetID(gadget), #EM_EXGETSEL, 0, sel)
    cf\dwMask = #CFM_COLOR|#CFM_BACKCOLOR|#CFM_BOLD|#CFM_ITALIC|#CFM_UNDERLINE|#CFM_STRIKEOUT
    cf\dwEffects = attrib
    cf\crTextColor = fcolor
    cf\crBackColor = bcolor
    SendMessage_(GadgetID(gadget), #EM_SETSEL, charstart, charend)
    SendMessage_(GadgetID(gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, @cf)
    SendMessage_(GadgetID(gadget), #EM_SETSEL, sel\cpMin, sel\cpMax)
  EndProcedure
  
#editor = 100
  
If OpenWindow(0, 100, 200, 500, 500, "PB 6.03 LTS (x86)", #PB_Window_SystemMenu)

  EditorGadget(#editor, 10, 10, 300, 25)
  SetGadgetText(#editor, "Dies ist ein Testtext")
  SetColor(#editor, 3, 12, #Red, #Black, #CFM_BOLD)
  
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf
Ergebnis:
Bild

Re: EditorGadget -> Formatierung funktioniert nicht mehr seit Umstellung auf PB 6.03 LTS

Verfasst: 21.05.2024 22:06
von techniker
Und schon hab ich eine Lösung gefunden.
Folgende Message an das EditorGadget direkt nach dem erstellen senden:

Code: Alles auswählen

SendMessage_(GadgetID(#editor), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)

Re: [gelöst] EditorGadget -> Formatierung funktioniert nicht mehr seit Umstellung auf PB 6.03 LTS

Verfasst: 28.07.2024 07:27
von stevie1401
Gibt es sowas auch für Linux?