The following could be attached to a logout button change script.
local integer status; set status to Login_ExitDataSource(); case status in [STATUS_CANT_LOGOUT] warning "Unable to log out due to open connection."; in [STATUS_ERROR] warning "An unknown error has occurred."; in [STATUS_NOT_LOGGED_IN] warning "A user isn't logged into a data source."; end case;