irgendwie funktionieren meine Ansteuerungen von Gadgets nicht unter Windows:
- um alles korrekt darzustellen, muss das ganze Fenster per Maus verschoben werden
- teilweise müssen Gadgets durch Mausklick "aktiviert" werden.
Geht das nur mir so oder haben auch andere Schwierigkeiten?
Welche Regeln gelten um "bessere" GUIs zu erzeugen?
Kann mir bitte jemand helfen?
Viele Grüße
LN
Code: Alles auswählen
#Font_5 = 5
Global wFontHeight.w
Procedure.w FontLaden() ;
If LoadFont(#Font_5, "Arial" , 12)
Else
Debug "Font 5 nicht geladen"
EndIf
EndProcedure
Enumeration 950
#NichtsGeschehen
#AbbruchOhneUebernahme
#EndeMitDatenuebernahme
#BestehendeDatenAuslesen
#InputGUI_OK
#InputGUI_Cancel
EndEnumeration
Procedure.w CheckContent(Content.s)
Protected result.w = 0
If Len(Content) < 3 Or Trim(Content) = ""
result = 5
EndIf
ProcedureReturn result
EndProcedure
Procedure Check_Input(GadgetNo.w)
Protected CheckContent.s
CheckContent = GetGadgetText(GadgetNo)
If CheckContent(CheckContent) > 1
SetGadgetColor(GadgetNo, #PB_Gadget_BackColor,RGB(255,0,0))
Else
SetGadgetColor(GadgetNo, #PB_Gadget_BackColor,RGB(255,255,255))
EndIf
EndProcedure
Procedure FillKramComboBox(GadgetNo.w)
AddGadgetItem(GadgetNo, -1 , "einerseits" )
AddGadgetItem(GadgetNo, -1 , "andererseits" )
AddGadgetItem(GadgetNo, -1 , "dannwieder" )
EndProcedure
Enumeration FormWindow
#WindowTest
EndEnumeration
Enumeration FormGadget
#WindowTest_Text_wTest1
#WindowTest_Text_sTest
#WindowTest_Text_fFloat
#WindowTest_Text_tStringtest
#WindowTest_Button_Ok
#WindowTest_Button_Cancel
#WindowTest_Button_FontPlus
#WindowTest_Button_FontMinus
#WindowTest_Combo_wTest1
#WindowTest_String_sTest
#WindowTest_String_fFloat
#WindowTest_String_tStringtest
EndEnumeration
Procedure OpenWindowTest(x = 0, y = 0, width = 700, height = 500)
OpenWindow( #WindowTest, x, y, width, height,"Zeuges" , #PB_Window_SystemMenu| #PB_Window_SizeGadget )
StickyWindow( #WindowTest, #True)
ButtonGadget( #WindowTest_Button_Ok, 580, 260, 100, 40, "OK")
ButtonGadget( #WindowTest_Button_Cancel, 450, 260, 100, 40, "Cancel")
TextGadget( #WindowTest_Text_wTest1, 20, 20, 160, 40, "Auswahl" )
TextGadget( #WindowTest_Text_sTest, 20, 80, 160, 40, "Text" )
TextGadget( #WindowTest_Text_fFloat, 20, 140, 160, 40, "Float" )
TextGadget( #WindowTest_Text_tStringtest, 20, 200, 160, 40, "LangText" )
ComboBoxGadget( #WindowTest_Combo_wTest1, 240, 20, 440, 40 )
StringGadget( #WindowTest_String_sTest, 240, 80, 440, 40, "")
StringGadget( #WindowTest_String_fFloat, 240, 140, 440, 40, "")
EditorGadget( #WindowTest_String_tStringtest, 240, 200, 440, 40);, "")
EndProcedure
Procedure FontSetzen(wInput.w)
SetGadgetFont( #WindowTest_Combo_wTest1, FontID(wInput))
SetGadgetFont( #WindowTest_Text_wTest1, FontID(wInput))
SetGadgetFont( #WindowTest_String_sTest, FontID(wInput))
SetGadgetFont( #WindowTest_Text_sTest, FontID(wInput))
SetGadgetFont( #WindowTest_String_fFloat, FontID(wInput))
SetGadgetFont( #WindowTest_Text_fFloat, FontID(wInput))
SetGadgetFont( #WindowTest_String_tStringtest, FontID(wInput))
SetGadgetFont( #WindowTest_Text_tStringtest, FontID(wInput))
EndProcedure
Procedure.w WindowTest_Event()
Protected result.w = 0
Protected event.w
Delay(5)
event = WindowEvent()
Select event
Case #PB_Event_CloseWindow
result = #AbbruchOhneUebernahme
Case #PB_Event_Gadget
Select EventGadget()
Case #WindowTest_Button_Cancel
result = #AbbruchOhneUebernahme
Case #WindowTest_Button_OK
result = #EndeMitDatenuebernahme
EndSelect
Default
result = #NichtsGeschehen
EndSelect
ProcedureReturn result
EndProcedure
Procedure.w STRG_MaskeTest()
Shared wFontHeight
wFontHeight = #Font_5
Protected switch.w
OpenWindowTest(0)
FillKramComboBox( #WindowTest_Combo_wTest1)
FontSetzen(wFontHeight)
; SetGadgetText( #WindowTest_String_sTest, "Dideldum")
; SetGadgetText( #WindowTest_String_fFloat, "1.453")
; SetGadgetText( #WindowTest_String_tStringtest, "BlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaBlaDideldum")
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
; Wie rette ich ich hier eine vollständige Darstellung?
UpdateWindow_(GadgetID( #WindowTest_Combo_wTest1))
UpdateWindow_(GadgetID( #WindowTest_String_sTest))
UpdateWindow_(GadgetID( #WindowTest_String_fFloat))
UpdateWindow_(GadgetID( #WindowTest_String_tStringtest))
UpdateWindow_(GadgetID( #WindowTest_Button_Ok ))
UpdateWindow_(GadgetID( #WindowTest_Button_Cancel ))
CompilerEndIf
Repeat
switch = WindowTest_Event()
If switch = #EndeMitDatenuebernahme
Else
Check_Input( #WindowTest_Combo_wTest1)
Check_Input( #WindowTest_String_sTest)
Check_Input( #WindowTest_String_fFloat)
Check_Input( #WindowTest_String_tStringtest)
EndIf
Until switch = #EndeMitDatenuebernahme Or switch = #AbbruchOhneUebernahme
CloseWindow(#WindowTest)
ProcedureReturn switch
EndProcedure
; los gehts
Fontladen()
STRG_MaskeTest( )