I am having some trouble changing the color for a dategadget . The doc says it can be done. Another problem is that when I move a date to the dategadget it then becomes unmodifiable if i just try to modify the text in the box. If I go into the calendar with a down arrow, it will allow me to change it but not if i just edit the text in the box for the date. Why is the date unmodifiable. I have created 2 small programs that are pretty contrived to try to show this. Hope someone can answer this.
Code: Select all
;this is the smalldate.pbf file
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
Global Window_1
Enumeration FormGadget
#Date_Test
#String_0
#String_1
EndEnumeration
Procedure OpenWindow_1(x = 0, y = 0, width = 600, height = 400)
Window_1 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
DateGadget(#Date_Test, 120, 160, 100, 25, "")
StringGadget(#String_0, 120, 90, 100, 25, "")
SetGadgetColor(#String_0, #PB_Gadget_BackColor,RGB(255,255,128))
StringGadget(#String_1, 120, 120, 100, 25, "")
SetGadgetColor(#String_1, #PB_Gadget_BackColor,RGB(255,255,128))
EndProcedure
Code: Select all
XIncludeFile "smalldate.pbf" ; Include the first window definition
OpenWindow_1()
Procedure Window_1_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #String_0
If GetGadgetText(#String_0) = "1"
SetGadgetText(#Date_Test,"12/31/2014")
SetGadgetColor(#Date_Test, #PB_Gadget_BackColor, $FFFF66)
Else
SetGadgetText(#Date_Test,"12/01/2014")
SetGadgetColor(#Date_Test, #PB_Gadget_BackColor, $FF0000)
EndIf
Case #String_1
If GetGadgetText(#String_1) = "2"
SetGadgetText(#Date_Test,"12/20/2014")
SetGadgetColor(#Date_Test, #PB_Gadget_BackColor, $00FFF66)
Else
SetGadgetText(#Date_Test,"12/02/2014")
SetGadgetColor(#Date_Test, #PB_Gadget_BackColor, $FF0000)
EndIf
Case #Date_Test
Debug "Date gadget used"
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
Repeat
Event = WaitWindowEvent()
Select EventWindow()
Case Window_1
Window_1_Events(Event) ; This procedure name is always window name followed by '_Events'
EndSelect
Until Event = #PB_Event_CloseWindow ; Quit on any window close