Page 1 of 1

Date Gadget Not Working Correctly

Posted: Thu Apr 05, 2012 11:19 am
by Jumbuck
Several programs written using a separate Events Handler for EACH Window were working just fine
until I tried to introduce PB's DATEGADGET into a window which I find will not work correctly.
Set up as gadget in my Emuneration section as #Gadget_ViewDate so should have it's own unique ID.
Set up in any window ;-
DateGadget(#Gadget_ViewDate, 160, 290, 120, 25, "%dd/%mm/%yyyy", Date(), #PB_Date_CheckBox)
Clicking the gadget in the window will open the pop-up calendar but any selected date will not display.
Have overcome this by adding the following in the window events allowing selection from calendar
and displaying date correctly formatted.
Case #Gadget_ViewDate
SetGadgetText(#Gadget_ViewDate,"%dd/%mm/%yyyy")
However the displayed date will not allow editing as a normal DateGadget does.
Without resorting to Single Event Handler for a program is there any work around to allow date editing
using this method of coding.
Thanks Jumbuck

Re: Date Gadget Not Working Correctly

Posted: Thu Apr 05, 2012 3:30 pm
by Demivec
Can you create a small code sample that can be compiled and executed to show the problem you are experiencing?

Re: Date Gadget Not Working Correctly

Posted: Sun Apr 22, 2012 2:36 am
by Demivec
Good news, I have found the solution to your problem after examining the code you provided

Make this change in the file '_FillMoviesWindowData.pbi' :

Code: Select all

;replace the first line for the second one
;SetGadgetText(#Gadget_ViewDate, \ViewDate) ;this sets the mask x)
SetGadgetState(#Gadget_ViewDate, ParseDate("%dd/%mm/%yyyy", \ViewDate))
You were setting the mask of the gadget to be the same as the date, which wouldn't allow any editing because when the date "01/03/2012" is used as a mask it doesn't allow any values to be entered (no %d, %m, or %y).

Re: Date Gadget Not Working Correctly

Posted: Sun Apr 22, 2012 3:29 am
by Fangbeast
Demivec wrote:Good news, I have found the solution to your problem after examining the code you provided

Make this change in the file '_FillMoviesWindowData.pbi' :

Code: Select all

;replace the first line for the second one
;SetGadgetText(#Gadget_ViewDate, \ViewDate) ;this sets the mask x)
SetGadgetState(#Gadget_ViewDate, ParseDate("%dd/%mm/%yyyy", \ViewDate))
You were setting the mask of the gadget to be the same as the date, which wouldn't allow any editing because when the date "01/03/2012" is used as a mask it doesn't allow any values to be entered (no %d, %m, or %y).
D'oh!! I read his code and couldn't see it. Too tired I guess.

Re: Date Gadget Not Working Correctly

Posted: Sun Apr 22, 2012 10:20 am
by Jumbuck
Thanks Demivec see PM sent today.
Jumbuck