DateTimePicker Control - Alpha 0.5

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

DateTimePicker Control - Alpha 0.5

Post 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
BERESHEIT
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

I keep getting a timeout while trying to download the code. Every minute I can't download deducts from your tip. Huuuurrrryy...
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Sorry - damn firewall. Could you try now?
BERESHEIT
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

It works now, maybe I'll test it later.
I like logic, hence I dislike humans but love computers.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Thanks, JLC, I hope you're mending well!
BERESHEIT
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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)
BERESHEIT
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Does not work on Win9x : UXTHEME.DLL not found.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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?
BERESHEIT
Post Reply