‎2006 Oct 19 9:26 PM
Hello All
How can I change the button text dynamically on a screen?
I have one button with the text: "Overwrite = OFF" and I want to change to "Overwrite = ON" when the user click on it, and if the user click again it will change back to "Overwrite = OFF".
TIA. Mauro.
Message was edited by: Mauro
‎2006 Oct 19 9:51 PM
‎2006 Oct 19 9:57 PM
I think that's kind of difficult cause you will have to search de properties of the screen. The best thing to do it could be to take a copy of the screen but with the text of the button you want, and set the screen in the event you want to catch.
I hope this idea be helpful.
‎2006 Oct 19 10:03 PM
Hi Mauro,
Here's the code:
* Required
TABLES:
sscrfields.
FIELD-SYMBOLS:
<field> TYPE ANY,
<value> TYPE ANY.
* Selection screen with one push button
SELECTION-SCREEN:
BEGIN OF BLOCK b1 WITH FRAME,
PUSHBUTTON 3(20) but1 USER-COMMAND cli1,
END OF BLOCK b1.
* Event
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'CLI1'.
LOOP AT SCREEN.
IF screen-name EQ 'BUT1'.
ASSIGN screen-name TO <field>.
ASSIGN (<field>) TO <value>.
IF <value> EQ 'Status = OFF'.
<value> = 'Status = ON'.
ELSE.
<value> = 'Status = OFF'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
* Cleanup (don't forget)
IF <field> IS ASSIGNED. UNASSIGN <field>. ENDIF.
IF <value> IS ASSIGNED. UNASSIGN <value>. ENDIF.
* Initial value set
INITIALIZATION.
but1 = 'Status = OFF'.Regards,
Rob.