Date Gadget Not Working Correctly

Just starting out? Need help? Post your questions and find answers here.
Jumbuck
User
User
Posts: 63
Joined: Mon Nov 03, 2008 8:30 am
Location: Australia

Date Gadget Not Working Correctly

Post 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
User avatar
Demivec
Addict
Addict
Posts: 4277
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Date Gadget Not Working Correctly

Post by Demivec »

Can you create a small code sample that can be compiled and executed to show the problem you are experiencing?
User avatar
Demivec
Addict
Addict
Posts: 4277
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Date Gadget Not Working Correctly

Post 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).
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4792
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Date Gadget Not Working Correctly

Post 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.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Jumbuck
User
User
Posts: 63
Joined: Mon Nov 03, 2008 8:30 am
Location: Australia

Re: Date Gadget Not Working Correctly

Post by Jumbuck »

Thanks Demivec see PM sent today.
Jumbuck
Post Reply