Um dem 64-Bit-Problem meiner gestern veröffentlichen Programme und API-Libraries auf die Spur zu kommen hab ich u.a. die nicht ganz konsequent durchgezogene Wandlung der Strings für 'gtk_'-Funktionen in UTF-8 in Verdacht.
Folgendes Beispiel zeigt ein Problem das es eigentlich (nach Forumsbeiträgen) nicht geben sollte...
Code: Alles auswählen
ImportC ""
gtk_widget_set_tooltip_text(*widget.GtkWidget, *text.p-utf8)
EndImport
EnableExplicit
; Object constants
#MainWin=0
#Text1= 0
#Text2= 1
#Text3= 2
#WinX=300
#WinY=200
#WinW=350
#WinH=100
Global.l gEvent, gQuit
Global *gMem
Procedure AsciiToUTF8(SAscii.s)
*gMem= AllocateMemory(StringByteLength(SAscii, #PB_UTF8) + 1)
PokeS(*gMem, SAscii, -1, #PB_UTF8)
ProcedureReturn *gMem
EndProcedure
If OpenWindow(#MainWin, #WinX, #WinY, #WinW, #WinH, "Tooltips to show UTF-8-problem", #PB_Window_SystemMenu)
TextGadget(#Text1, 5, 10, 290, 25, "Mouseover - pre-converted 2 UTF-8 with 'Umlauts'")
TextGadget(#Text2, 5, 40, 290, 25, "Mouseover - not pre-converted with 'Umlauts'")
TextGadget(#Text3, 5, 70, 290, 25, "Mouseover - not pre-converted without 'Umlauts'")
gtk_widget_set_tooltip_text(GadgetID(#Text1), AsciiToUTF8("with UTF8-per-conversion ÄÖÜäöüß"))
;*** Auf der nächsten Zeile gibts entkommentiert 'ungültigen Speicherzugriff' with 'Umlauts', trotz p-utf8 *** ...
;gtk_widget_set_tooltip_text(GadgetID(#Text2), @"without UTF8-per-conversion, with 'Umlauts' ÄÖÜäöüß")
gtk_widget_set_tooltip_text(GadgetID(#Text3), @"without UTF8-per-conversion, without Umlauts")
FreeMemory(*gMem); frees mem for UTF-8-conversion
Repeat
gEvent= WaitWindowEvent()
Select gEvent
Case #PB_Event_CloseWindow
gQuit= #True
EndSelect
Until gQuit
EndIf
Hat jemand eine Ahnung wie dies korrekt behandelt werden sollte?
Das Beispiel auf #Text1 wäre doppelt-gemoppelt, funktioniert aber.
Gruß
Charly