Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Unknown macro: {alias}

Name

qcloseevent — catch close events

Syntax

qcloseevent [widget] cmds

Description

The qcloseevent command allows one to catch the closing of windows (qwidgets and qmainwindows). The programmer can assign Tcl commands to be executed during the closing of the window, useful for cleanup actions or for cancelling the close event.

Arguments

widget

cmds

Examples

Ex.1: Catching a close event

# Callback procedure for closeevent
proc ce {} {
	puts "Closing"
	
	set button [qinformation "Closing Window" "Really close window?" OK Cancel]
	if { $button == 1 } {  ; # cancel
		return ignore
	}
}

set w [qwidget ]

# Call 'ce' when closing
qcloseevent $w ce

qshow $w

Example Catching a close event shows the procedure 'ce' assigned as a callback function to be called when the window 'w' is closed. The user is then asked whether he wants the window closed or not. Note that not providing a return value in the proc will accept the event.

  • No labels