Wenn man wie ich nur Ascii Programme erstellt, muß man mit entsprechenden Befehlen AsciiStrings in Unicode umwandeln. Irgendwie nervig.
Aber PB machts selbst via Prototype
Eine Demo
Code: Alles auswählen
;PB 5.21 Windows Vista x86 - in Compiler-Option Unicode aus
DeclareModule Prototype_Api
Declare.i SetComboBoxBannerText(pbnr, text$)
Declare.i SetEditBoxBannerText(pbnr, text$)
EndDeclareModule
Module Prototype_Api
Import "" ;aus der USER32.lib
mySendMessage(a,b,c,d) As "_SendMessageA" ;oder _SendMessageW
EndImport
Prototype SETCUEBANNER(a, b, c, text.p-unicode)
Global SETCUEBANNER.SETCUEBANNER = @mySendMessage()
Procedure.i SetComboBoxBannerText(pbnr, text$)
SetGadgetText(pbnr, "")
SETCUEBANNER(GadgetID(pbnr), #CB_SETCUEBANNER, 0, text$)
EndProcedure
Procedure.i SetEditBoxBannerText(pbnr, text$)
SetGadgetText(pbnr, "")
SETCUEBANNER(GadgetID(pbnr), #EM_SETCUEBANNER, 0, text$)
EndProcedure
EndModule
UseModule Prototype_Api
Enumeration
#window
#combo0
#combo1
#string
#text
EndEnumeration
OpenWindow(#window, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu)
ComboBoxGadget(#combo0, 11, 11, 111, 22)
ComboBoxGadget(#combo1, 11, 51, 111, 22, #PB_ComboBox_Editable)
StringGadget(#string, 11, 91, 111, 22, "")
TextGadget(#text, 11, 131, 111, 32, "")
For j = 1 To 5
AddGadgetItem(#combo0, -1, "ComboBox item " + Str(j))
AddGadgetItem(#combo1, -1, "ComboBox item " + Str(j))
Next
SetComboBoxBannerText(#combo0, "Auswahl 1")
SetComboBoxBannerText(#combo1, "Auswahl 2")
SetEditBoxBannerText(#string, "Blah Blah")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case #combo0
If EventType() = #PB_EventType_Change
SetGadgetText(#text, "Auswahl Combo oben: " + GetGadgetText(#combo0))
SetComboBoxBannerText(#combo0, "Auswahl 1")
EndIf
Case #string
If EventType() = #PB_EventType_LostFocus
SetEditBoxBannerText(#string, GetGadgetText(#string))
EndIf
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
