Welcome to Pauls PureProject
 Home Online Reference Guide duplicated from http://cvs.purebasic.com  
 Online Resources
   · Reference

 Libraries
     2DDrawing
     Billboard
     Camera
     CDAudio
     Cipher
     Clipboard
     Console
     Database
     Date
     Desktop
     Engine3D
     Entity
     File
     FileSystem
     Font
     Gadget
     Help
     Image
     ImagePlugin
     Joystick
     Keyboard
     Library
     Light
     LinkedList
     Material
     Math
     Memory
     Menu
     Mesh
     Misc
     Module
     Mouse
     Movie
     Network
     OnError
     Packer
     Palette
     Particle
     Preference
     Printer
     Requester
     Sort
     Sound
     SoundPlugin
     Sprite
     Sprite3D
     StatusBar
     String
     SysTray
     Terrain
     Texture
     Thread
     Toolbar
     Window

 DateGadget

Syntax

Result = DateGadget(#Gadget, x, y, Width, Height [, Mask$ [, Date [, Flags]]])
Description
Creates a String gadget in the current GadgetList, in which a date and/or time can be entered. This gadget uses the same date format for its functions as used by the Date library. So you can use for example FormatDate() to display the results you get from GetGadgetState() in a proper format. If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'. #Gadget will be the numeric identifier returned by the EventGadgetID() command.

With the optional Mask$ parameter you can specify the format in which the date can be entered. See FormatDate() for the format of this mask. Important note: The gadget does not support the display of seconds, so if you specify "%ss" in the Mask$ parameter, it will simply be ignored! If you don't specify the mask or specify an empty string, a default mask will be choosen. The mask can be modified with the SetGadgetText() command. With the optional Date parameter you can set the displayed date to any date of your choise. Not specifying it or specifying a 0 value will display the current date. By default, the gadget has a button to display a calendar in which the user can choose a date (see image below). You can change this by specifying #PB_Date_UpDown in the Flags parameter. This will make the gadget display an up/down button that lets the user change the current selected part of the gadget.
If you specify #PB_Date_Checkbox in the Flags parameter, the Gadget will have a checkbox with which the user can set the Gadget to 'no date' (if the checkbox is unchecked). While the checkbox is unchecked, GetGadgetState() will return 0. To change the state of the checkbox, use SetGadgetState() with either 0 (=checkbox unchecked) or any valid date (=checkbox checked).

You can add a 'mini help' to this gadget by using GadgetToolTip().

The following commands can be used for this gadget:

- SetGadgetState(): Set the currently displayed date.
- SetGadgetText(): Change the input mask of the gadget.
- SetGadgetAttribute(): Set a minimum/maximum date that the user can choose.
- GetGadgetState(): Get the currently displayed date.
- GetGadgetText(): Get the current displayed date as a string, as it is displayed in the gadget.
- GetGadgetAttribute(): Get the minimum/maximum date for the gadget.

Example:
  If OpenWindow(0, 0, 0, 200, 250, #PB_Window_SystemMenu|#PB_Window_Screencentered,"DateGadget()")
    If CreateGadgetList(WindowID())
      DateGadget(0, 10, 10, 180, 25, "Date: %mm/%dd/%yyyy Time: %hh:%ii")
      Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
    EndIf
  EndIf

Supported OS

Windows, Linux

<- CreateGadgetList() - Gadget Index - DisableGadget() ->



Hosted by Reel Media Productions Copyright©2001-2004 All Rights Reserved