Page 1 of 1

Actual time

Posted: Wed Sep 03, 2014 10:08 am
by nartex
Hi guys,

I am a beginner in programming and Im big fan of PureBasic. I want try programming very easy things for begin, and I wanna make easy actual time with MessageRequester. Something like : "Actual time is :"+time what be actualized every second. And of curse it must works in demo (ver. 5.30)... Do you have solution for me?

THX

Andrej

Re: Actual time

Posted: Wed Sep 03, 2014 10:16 am
by ts-soft

Code: Select all

MessageRequester("", "Actual time is: " + FormatDate("%hh:%ii:%ss", Date()))
Actualized every Call.

Or something like this:

Code: Select all

Procedure SetStaturBar()
  StatusBarText(0, 0, "  " + FormatDate("%hh:%ii:%ss", Date()))
EndProcedure

OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 400, "")
If CreateStatusBar(0, WindowID(0))
  AddStatusBarField(60)
EndIf

AddWindowTimer(0, 1, 1000)
BindEvent(#PB_Event_Timer, @SetStaturBar(), 0)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver

Re: Actual time

Posted: Wed Sep 03, 2014 11:00 am
by nartex
Great,
I needed exactly this. Thank you for your support...I tried make another easy sh*t with messagereqester to locate a mouse cursor. PB have few functions for mouse, I used MouseX and MouseY, but was necessary used ExamineMouse. Something was wrong and I dont know what is it. Here is my bad example :
ExamineMouse()
MessageRequester("", "Actual position of mouse cursor is: " + MouseX +" " + MouseY)

What is wrong with this?

Re: Actual time

Posted: Wed Sep 03, 2014 11:24 am
by ts-soft
No InitMouse(), no screen.

Use this:

Code: Select all

MessageRequester("", "Actual position of mouse cursor is: " + DesktopMouseX() + "," + DesktopMouseY())