Files
2025-10-14 09:52:32 +09:00

75 lines
2.0 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Example for dialog with an included output area for text
; @Description: Shows a dialog with area
; @Keywords: practice, dialog, area
; @Author: SME
; @Copyright: (C) 1989-2021 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Id: dialog_area.cmm 18691 2021-12-15 18:51:36Z rweiss $
;Create new area "testarea"
AREA.Create testarea 40. 100.
AREA.CLEAR testarea
PRINT "---------1---------2---------3---------4"
PRINT "40 chars wide and 100 lines in height"
;and attach it to a dialog with a simple close button
;The dialog is 40 chars wide and includes 10 lines of text
WINPOS , , 40. 10.
DIALOG.AREA testarea
(
;DIALOG elements
HEADER "DIALOG.AREA example"
POS 0.25 0. 20. 1.
LINENUM: DYNTEXT "Lines printed: 0."
POS 0.25 1. 11. 1.
BUTTON "Print some text" "GOSUB OnBtnClicked_PRINT"
POS 12. 1. 10. 1.
BTN_CLEAN: BUTTON "Clear area" "GOSUB OnBtnClicked_CLEAR"
; close button
POS 28.5 1. 8. 1.
BUTTON "Close" "GOSUB OnClose"
;dialog open event
INIT
(
DIALOG.STORAGE.define &linecount
&linecount=0.
;initialy disable clean button
DIALOG.DISABLE BTN_CLEAN
)
;dialog close event
CLOSE "GOSUB OnClose"
;dialog subroutines
SUBROUTINE OnBtnClicked_PRINT
(
LOCAL &tmp
&tmp=FORMAT.DECIMAL(3,&linecount)
AREA.Select testarea
PRINT "&tmp: Some more text in the area"
&linecount=&linecount+1.
DIALOG.SET LINENUM "Lines printed: &linecount"
; enable clean button
DIALOG.Enable BTN_CLEAN
)
SUBROUTINE OnBtnClicked_CLEAR
(
AREA.CLEAR testarea
&linecount=0.
DIALOG.set LINENUM "Lines printed: &linecount"
; disable clean button
DIALOG.Disable BTN_CLEAN
)
SUBROUTINE OnClose
(
DIALOG.END
AREA.Delete testarea
)
)
ENDDO