Restored from previous forum. Originally posted by Nessie.
Can someone tell me if it is possible to mask the input of a string gadget or a spin gadget, as I am trying to format the time input. Is there anyway I can place a : to seperate the hours from the minutes? or is there an API function I can call instead?
String Gadget Mask?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
If an Event for your StringGadget occurs, you can check with EventType() if it is #PB_EventType_Change.
This means, that the User changed the contents of the Gadget. You can then use GetGadgetText()/SetGadgetText() to add your ':' wherever you want to.
You can also create 2 seperate StringGadgets for Hours/Minutes, and put a TextGadget with ':' inbetween.
Timo
If an Event for your StringGadget occurs, you can check with EventType() if it is #PB_EventType_Change.
This means, that the User changed the contents of the Gadget. You can then use GetGadgetText()/SetGadgetText() to add your ':' wherever you want to.
You can also create 2 seperate StringGadgets for Hours/Minutes, and put a TextGadget with ':' inbetween.
Timo
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Kale.
i had a similar type thing in an app i wrote, i contained the time display inside a function:
i had a similar type thing in an app i wrote, i contained the time display inside a function:
Code: Select all
;sort out the time and display it
Procedure setTime()
currentDate = Date()
hours.b = Hour(currentDate)
minutes.b = Minute(currentDate)
seconds.b = Second(currentDate)
append.s = "am"
If hours >= 12
append.s = "pm"
EndIf
If hours = 0
hours = 12
EndIf
If hours > 12
hours = hours-12
EndIf
If minutes [i]Getting used to PureBasic and falling in Love![/i] :)-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm