Page 1 of 1

DateTimePicker Control - Alpha 0.5

Posted: Tue Sep 19, 2006 7:08 pm
by netmaestro
I'm building a DateTimePicker control and I have the first part done. I'm working on the Timezone part now, and while I'm doing that I'd appreciate any bughunting I can get on the TimePicker.

You just call DateTimePicker(x, y, <parent handle>) to use it, it doesn't need a gadgetlist. For use on a panelgadget item, I've included a command in the library, GetItemHandle(gadgetid(#gadget), item) which allows to easily get the window handle of the panel gadget item.

Here's a demo:

Code: Select all

; Main window demo
OpenWindow(0,0,0,500,348,"",$CF0001)
DateTimePicker(20, 20, WindowID(0))
Repeat:Until WaitWindowEvent()=#WM_CLOSE
CloseWindow(0)

MessageRequester("Notice","Press OK to see next demo", $C0)

; Panel demo
OpenWindow(0,0,0,500,348,"",$CF0001)
CreateGadgetList(WindowID(0))
  PanelGadget(0,0,00,500,348)
  AddGadgetItem(0,0,"Panel 0")
  AddGadgetItem(0,1,"Panel 1")
  AddGadgetItem(0,2,"Panel 2")
CloseGadgetList()
DateTimePicker(20, 20, GetItemHandle(GadgetID(0),1))

Repeat:Until WaitWindowEvent()=#WM_CLOSE
Any help you can give me in the way of bug reporting or suggestions for the control are much appreciated. Thanks!

http://www.networkmaestro.com/DateTimePicker.zip

Posted: Tue Sep 19, 2006 7:15 pm
by Xombie
I keep getting a timeout while trying to download the code. Every minute I can't download deducts from your tip. Huuuurrrryy...

Posted: Tue Sep 19, 2006 7:18 pm
by netmaestro
Sorry - damn firewall. Could you try now?

Posted: Tue Sep 19, 2006 7:32 pm
by Joakim Christiansen
It works now, maybe I'll test it later.

Posted: Tue Sep 19, 2006 7:38 pm
by netmaestro
Thanks, JLC, I hope you're mending well!

Posted: Wed Sep 20, 2006 1:27 am
by netmaestro
Sorry, I forgot to mention you can use the commands in this lib to add a working clock to your form:

Code: Select all

Procedure SetClock(delay)
  Repeat
    ClockSetTime(Hour(Date()),Minute(Date()),Second(Date()))
    Delay(delay)
  ForEver
EndProcedure

OpenWindow(0,0,0,320,240,"",$CF0001)
CreateGadgetList(WindowID(0))
ClockGadget(#PB_Any, 90,30, GetSysColor_(#COLOR_BTNFACE))
ShowOff(ClockGetHours(),ClockGetMinutes(),ClockGetSeconds())
Global tid = CreateThread(@SetClock(),1000)
Repeat:Until WaitWindowEvent()=#WM_CLOSE
(best to use the latest one)

Posted: Wed Sep 20, 2006 9:49 am
by gnozal
Does not work on Win9x : UXTHEME.DLL not found.

Posted: Wed Sep 20, 2006 1:50 pm
by netmaestro
OK, thanks gnozal. It only uses that dll for one call, GetWindowTheme_( so it can look a bit nicer if themes are enabled, but I can put a test in so it won't do that if the dll isn't available. Thanks for letting me know.

Posted: Wed Sep 20, 2006 2:48 pm
by srod
If you're just checking whether the application is using xp themes (rather than an individual window using a visual style), then you can check whether the common controls version 6 dll is mapped into the app space. This avoids relying upon UxTheme.dll etc.

Depends on how precise you need to be I guess.

Posted: Wed Sep 20, 2006 8:08 pm
by netmaestro
you can check whether the common controls version 6 dll is mapped into the app space
Sorry to appear dense, how do I do that?