B4A Library [B4X] [XUI] AS TimePicker

This is a simple TimePicker, with android style.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

Animation.gif
MinuteSteps.gif
12h Format.gif

Events
  • SelectedHourChanged and SelectedMinuteChanged
    • This event is triggered every time the pointer moves
  • SelectedHour and SelectedMinute
    • This event is triggered when you release the pointer
  • SelectionDone
    • This event is triggered when an hour and minute is selected
Designer Properties
  • AutoSwitch
    • If True then automatically switches to minutes when the user releases the clock during hour selection
  • MinuteSteps
    • Indicates in how many steps the selector can be moved
    • Example: 5 = the pointer only moves in 5 minute increments
  • TimeFormat
    • If 24h then 2 rows are displayed
    • If 12h just 1 row are visible
ASTimePicker
Author: Alexander Stolte
Version: 1.00

  • AS_TimerPicker
    • Events:
      • SelectedHour (Hour As Int)
      • SelectedHourChanged (Hour As Int)
      • SelectedMinute (Minute As Int)
      • SelectedMinuteChanged (Minute As Int)
      • SelectionDone (Hour As Int, Minute As Int)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • getAutoSwitch As Boolean
      • getBackgroundColor As Int
      • getCurrentMode_HourSelection As String
      • getCurrentMode_MinuteSelection As String
      • getMinuteSteps As Int
      • getTextColor As Int
      • getThumbColor As Int
      • getThumbLineColor As Int
      • getTimeFormat As String
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Refresh As String
      • setAutoSwitch (Auto As Boolean) As String
      • setBackgroundColor (Color As Int) As String
      • setCurrentMode (Mode As String) As String
      • setMinuteSteps (Steps As Int) As String
      • setTextColor (Color As Int) As String
      • setThumbColor (Color As Int) As String
      • setThumbLineColor (Color As Int) As String
      • setTimeFormat (Format As String) As String
    • Properties:
      • AutoSwitch As Boolean
      • BackgroundColor As Int
      • CurrentMode
      • CurrentMode_HourSelection As String [read only]
      • CurrentMode_MinuteSelection As String [read only]
      • MinuteSteps As Int
      • TextColor As Int
      • ThumbColor As Int
      • ThumbLineColor As Int
      • TimeFormat As String
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
  • 1.02 (read more)
    • BugFixes
    • Add get and set Hours
    • Add get and set Minutes
  • 1.03 (read more)
    • Add SmoothModeChange - Fade in mode change
  • 1.04
    • 12h Format now has a 12 at the top
  • 1.05
    • BugFix
  • 1.06
    • BugFix
Have Fun :)
 

Attachments

  • AS TimePicker Example.zip
    10.4 KB · Views: 192
  • AS_TimePicker.b4xlib
    3.8 KB · Views: 168
Last edited:

netsistemas

Active Member
Licensed User
Longtime User
i using you control.
Thanks.
how change from minute to hour panel. (back to previous panel)
 

Roldanx

Member
Este é um TimePicker simples, com estilo android.

Eu gasto muito tempo criando visualizações, como essa e criar uma visualização de alta qualidade custa muito tempo. Se você quiser me apoiar e outras visualizações, pode fazê-lo aqui pelo Paypal ou com um café .:)

View attachment 128364View attachment 128414View attachment 128415
Eventos
  • SelectedHourChanged e SelectedMinuteChanged
    • Este evento é acionado toda vez que o ponteiro se move
  • SelectedHour e SelectedMinute
    • Este evento é acionado quando você solta o ponteiro
  • SeleçãoConcluída
    • Este evento é acionado quando uma hora e um minuto são selecionados
Propriedades do Designer
  • Troca automática
    • Se True muda automaticamente para minutos quando o usuário libera o relógio durante a seleção de hora
  • MinuteSteps
    • Indica em quantos passos o seletor pode ser movido
    • Exemplo: 5 = o ponteiro só se move em incrementos de 5 minutos
  • Formato de hora
    • Se 24h, 2 linhas são exibidas
    • Se 12h apenas 1 linha estiver visível
ASTimePicker
Autor: Alexander Stolte
Versão: 1.00

  • AS_TimerPicker
    • Eventos:
      • SelectedHour (Hora As Int )
      • SelectedHourChanged (Hora As Int )
      • SelectedMinute (Minuto como Int )
      • SelectedMinuteChanged (Minute As Int )
      • SelectionDone (Hora As Int , Minute As Int )
    • Campos:
      • mBase como B4XView
      • Marcar como objeto
    • Funções:
      • Class_Globals como String
      • DesignerCreateView (Base As Object , Lbl As Label , Props As Map )
        O tipo base deve ser Object
      • getAutoSwitch As Boolean
      • getBackgroundColor As Int
      • getCurrentMode_HourSelection Como String
      • getCurrentMode_MinuteSelection como string
      • getMinuteSteps As Int
      • getTextColor As Int
      • getThumbColor As Int
      • getThumbLineColor As Int
      • getTimeFormat Como String
      • Inicializar (Callback As Object , EventName As String ) As String
      • IsInitialized As Boolean
        Testa se o objeto foi inicializado.
      • Atualizar como string
      • setAutoSwitch (Auto As Boolean ) As String
      • setBackgroundColor (Color As Int ) As String
      • setCurrentMode (Mode As String ) As String
      • setMinuteSteps (Steps As Int ) As String
      • setTextColor (Color As Int ) As String
      • setThumbColor (Color As Int ) As String
      • setThumbLineColor (Color As Int ) As String
      • setTimeFormat (Format As String ) As String
    • Propriedades:
      • AutoSwitch como booleano
      • BackgroundColor As Int
      • Modo atual
      • CurrentMode_HourSelection As String [somente leitura]
      • CurrentMode_MinuteSelection como string [somente leitura]
      • MinuteSteps As Int
      • TextColor As Int
      • ThumbColor As Int
      • ThumbLineColor As Int
      • Formato de hora como string
Registro de alterações
  • 1,00
    • Liberar
  • 1,01
    • Correções de bugs
Divirta-se:)
Belo trabalho, acredito que vai ser muito util.
 

netsistemas

Active Member
Licensed User
Longtime User
another...
and set hour or minutes?
simil to AS_TimerPicker1.SetMinute and SetHour (and refresh)
 

netsistemas

Active Member
Licensed User
Longtime User
and i view a little bug:
when you select hour: 16, and set to minutes, a retriev to hour, the hour rounded alway are the external, that is 04

16 are internal hour, 04 external our. Set 16, change to minutes - > change to hour. What hour are selected?
 

Alexander Stolte

Expert
Licensed User
Update
  • 1.02
    • BugFixes
    • Add get and set Hours
    • Add get and set Minutes
setMinutes
B4X:
AS_TimerPicker1.Minutes = 30
AS_TimerPicker1.Refresh
setHours
B4X:
AS_TimerPicker1.Hours = 16 '16 o clock
AS_TimerPicker1.Refresh
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Nice work!

I know this is only a MINOR detail, but I think in Android when you've selected the hour, the entire clock fades out and the minutes fade in. Now the switch between them is kind of abrupt.
 

mmieher

Active Member
Licensed User
Longtime User
I cannot figure out why the attached is not setting the indicator to the desired hour or minute position? Trying to set hour to 16 like the example.

And what is up with the log?

B4X:
Waiting for debugger to connect...
Program started.
SelectedHourChanged: 28
SelectedHourChanged: 0
 

Attachments

  • ASDPTest.zip
    2.2 KB · Views: 58

mmieher

Active Member
Licensed User
Longtime User
Update
  • 1.05
    • BugFix
Put a sleep(0) before you set the Hours, is only needed at the start of the form
Thanks. It is better. Selector thing still not moving to 16-o-clock. Why does it change to zero after I set it to 16? That must be the real issue.
B4X:
Waiting for debugger to connect...
Program started.
SelectedHourChanged: 16
SelectedHourChanged: 0
 
Top