11-29-2005 8:31 AM
Hi,
Does anyone know how to put a realtime moving clock one the screen ?
Just like the clock showing on the bottom-right of the Window screen...
Thanks for your help.....
11-29-2005 8:48 AM
Hi again,
CLOCK ON SCREEN. (Thru write statement)
(This sample code will give an insight
to many abapers who are still wondering
about the concept of TIMER IN ABAP
as compared to other programming languages)
(Timer in ABAP was also a mystery to me
some time back ago)
The Code : (Just Copy Paste)
REPORT abc NO STANDARD PAGE HEADING.
DATA : wa(72) TYPE c.
*----
CLASS my DEFINITION.
PUBLIC SECTION.
METHODS : run_handler FOR EVENT finished OF cl_gui_timer.
ENDCLASS. "my DEFINITION
DATA timer TYPE REF TO cl_gui_timer.
DATA myh TYPE REF TO my.
----
CLASS my IMPLEMENTATION
----
*
----
CLASS my IMPLEMENTATION.
METHOD run_handler.
CALL METHOD timer->run.
PERFORM mylist.
ENDMETHOD. "run_handler
ENDCLASS. "my IMPLEMENTATION
*----
*----
Init
INITIALIZATION.
CREATE OBJECT timer.
CREATE OBJECT myh.
SET HANDLER myh->run_handler FOR ALL INSTANCES.
PARAMETERS : a TYPE c.
*----
End of selection
START-OF-SELECTION.
WRITE sy-uzeit TO wa.
WRITE wa.
timer->interval = '0.5'.
CALL METHOD timer->run.
*----
FORM mylist.
WRITE sy-uzeit TO wa.
MODIFY LINE 1 LINE VALUE FROM wa.
ENDFORM. "MYLIST
Hope the above helps.
Regards,
Amit M.
Message was edited by: Amit Mittal
Message was edited by: Amit Mittal
11-29-2005 8:35 AM
Hi Kokwei,
1. I u are talking about the clock in the form of
2:10 PM
Yes
we can do it using TIMER Concept
Using Cl_GUI_TIMER Class.
2. If u want sample code, i can provide.
3. If u are talking about graphical clock,
then i have not tried that.
Regards,
Amit M.
11-29-2005 8:43 AM
11-29-2005 8:48 AM
Hi again,
CLOCK ON SCREEN. (Thru write statement)
(This sample code will give an insight
to many abapers who are still wondering
about the concept of TIMER IN ABAP
as compared to other programming languages)
(Timer in ABAP was also a mystery to me
some time back ago)
The Code : (Just Copy Paste)
REPORT abc NO STANDARD PAGE HEADING.
DATA : wa(72) TYPE c.
*----
CLASS my DEFINITION.
PUBLIC SECTION.
METHODS : run_handler FOR EVENT finished OF cl_gui_timer.
ENDCLASS. "my DEFINITION
DATA timer TYPE REF TO cl_gui_timer.
DATA myh TYPE REF TO my.
----
CLASS my IMPLEMENTATION
----
*
----
CLASS my IMPLEMENTATION.
METHOD run_handler.
CALL METHOD timer->run.
PERFORM mylist.
ENDMETHOD. "run_handler
ENDCLASS. "my IMPLEMENTATION
*----
*----
Init
INITIALIZATION.
CREATE OBJECT timer.
CREATE OBJECT myh.
SET HANDLER myh->run_handler FOR ALL INSTANCES.
PARAMETERS : a TYPE c.
*----
End of selection
START-OF-SELECTION.
WRITE sy-uzeit TO wa.
WRITE wa.
timer->interval = '0.5'.
CALL METHOD timer->run.
*----
FORM mylist.
WRITE sy-uzeit TO wa.
MODIFY LINE 1 LINE VALUE FROM wa.
ENDFORM. "MYLIST
Hope the above helps.
Regards,
Amit M.
Message was edited by: Amit Mittal
Message was edited by: Amit Mittal
11-29-2005 8:59 AM
11-29-2005 11:55 AM
Hi kokwei,
1. if you are new let me introduce to the
forum ethics.
2. If u find any answer useful, pls reward
points by clicking the STAR on the left of the reply.
3. Kindly reward points if ur query has been solved
or if u found the answer useful.
Regards,
Amit M.
04-19-2007 11:42 AM
Hi All,
I went through the discussion but i think the suggestions and informations are not upto the expectation.
Now you may try for this code.
Here I am NOT USING ANY CLASS OBJECTS .
N.B. Create a PF status GAME with a button TIMER having a dynamic text.
Create a function module like 'zmart_timer' which
contains nothing as source code then use this code.
************************************
REPORT ZMART_REALTIMER_NEW .
data: v_flag,
v_times TYPE I,
TIMER(12) .
INITIALIZATION.
v_times = 1.
START-OF-SELECTION.
PERFORM start_timer.
AT USER-COMMAND.
IF SY-UCOMM = 'PLAY'.
v_times = 1.
CLEAR V_FLAG.
ENDIF.
perform sub_write.
PERFORM status_call.
FORM START_REFRESH USING TASKNAME.
SET USER-COMMAND '123'.
ENDFORM.
form sub_write.
SY-LSIND = 0.
CONCATENATE SY-UZEIT0(2) ':' SY-UZEIT2(2) ':' SY-UZEIT+4(2) INTO TIMER.
endform.
form start_timer .
SET PF-STATUS 'GAME'.
CALL FUNCTION 'ZMART_TIMER'
starting new task '*'
performing start_refresh on end of task.
WRITE:/21 'Created by Smart Varghese'.
endform. " start_timer
form status_call .
IF SY-UCOMM = 'BACK'.
LEAVE PROGRAM.
ENDIF.
IF V_FLAG = SPACE.
wait up to '.1' SECONDS.
CALL FUNCTION 'ZMART_TIMER'
starting new task '*'
performing start_refresh on end of task.
ENDIF.
endform. " status_call
********************************************
If found useful please reward points by clicking on the STAR right of the reply.
Message was edited by:
smart varghese