Actual time

Just starting out? Need help? Post your questions and find answers here.
nartex
New User
New User
Posts: 3
Joined: Wed Sep 03, 2014 6:10 am
Location: Slovakia

Actual time

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Actual time

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
nartex
New User
New User
Posts: 3
Joined: Wed Sep 03, 2014 6:10 am
Location: Slovakia

Re: Actual time

Post 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?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Actual time

Post by ts-soft »

No InitMouse(), no screen.

Use this:

Code: Select all

MessageRequester("", "Actual position of mouse cursor is: " + DesktopMouseX() + "," + DesktopMouseY())
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply