Hi, Thanks Square. Now time for my usual comments ;) 1 - Try to always send a clean patch, don't mix up two things in one patch, it just becomes difficult to know what to look at. If you want all your changes in, then divide them in multiple diff files and explain what each one does. Like there's one where you add a comment.. I don't want to waste time reading that trying to figure out if it has anything to do with the close tabs bug.. > - set filesizeM [expr {int($filesize/1048576)}] > + set filesizeM [expr {int($filesize/1048576)}] ;#Converts in > MBytes
2 - You put : > + if {[winfo exists ".messagebox_$unique"]} { return } This means that the customMessageBox will return "" what happens in that case? did you do a grep on all customMessageBox calls to see what would happen if that function returns nothing ? think of something like that : set ret [customMessageBox ... ] if { $ret == "yes" } { set close 1 } elseif {$ret == "no" } { set close 0 } if { $close } { ... } With your patch, we'll get an error with "close : undefined variable" So you have two choices (or 3) : a) Make customMessageBox return "duplicate" (or "") and do a grep and wherever you find a call to customMessageBox, you make sure to check for the "duplicate" case (and make sure that if you just return that it won't affect the function that called the function that called customMessageBox, etc...) b) return "cancel" and make sure that it won't affect anything... 3 - Why did you name the variable "block" you could have named it "unique" instead, it would have been more logical and easier to understand/maintain Thanks, KaKaRoTo On Wed, Oct 10, 2007 at 05:54:05PM +0000, square87 wrote: > Hello. > I found the following problem: > Open two or more tabs in a chatwindow then press on X to close them. > You'll see a windows that ask if you want to close all tabs or only the > current tab. > Now click again on the previous X, you'll get another window that ask what > do you want to close. > So now in this window click on Yes then you still have another window click > Yes again, you'll get an error window (amen). > > I wrote a possible solution. > In the diff file there are also some code changes, that remove useless set > > Then in: > @@ -789,7 +795,7 @@ > I changed the padx value from 0 to 3 because buttons aren't separated. > > Thanks, bye. > Square87 > Index: chatwindow.tcl > =================================================================== > --- chatwindow.tcl (revisione 9066) > +++ chatwindow.tcl (copia locale) > @@ -265,7 +265,8 @@ > } elseif {[::config::isSet closeChatWindowWithTabs]} { > ::ChatWindow::CloseTab $currenttab > } else { > - set result [::amsn::customMessageBox [trans closeall] > yesnocancel question [trans title] $window 1 1] > + > + set result [::amsn::customMessageBox [trans closeall] > yesnocancel question [trans title] $window 1 1 "ContainerClose"] > set answer [lindex $result 0] > set rememberAnswer [lindex $result 1] > > @@ -280,8 +281,7 @@ > if { $answer == "yes" } { > ::ChatWindow::CloseAll $window > destroy $window > - } > - if { $answer == "no" } { > + } elseif { $answer == "no" } { > ::ChatWindow::CloseTab $currenttab > } > } > Index: gui.tcl > =================================================================== > --- gui.tcl (revisione 9066) > +++ gui.tcl (copia locale) > @@ -708,14 +708,20 @@ > > #/////////////////////////////////////////////////////////////////////////////// > > > #/////////////////////////////////////////////////////////////////////////////// > - proc customMessageBox { message type {icon ""} {title ""} {parent ""} > {askRememberAnswer 0} {modal 0}} { > + proc customMessageBox { message type {icon ""} {title ""} {parent ""} > {askRememberAnswer 0} {modal 0} {block ""} } { > # This tracker is so we can TkWait. It needs to be global so > that the buttons can modify it. > global customMessageBoxAnswerTracker > # This is the tracker for the checkbox. > # It needs to be an array because we may have more than one > message box open (hence the unique index). > global customMessageBoxRememberTracker > > - set unique [clock seconds] > + if {$block == ""} { > + set unique [clock seconds] > + } else { > + set unique $block > + if {[winfo exists ".messagebox_$unique"]} { return } > + } > + > set w ".messagebox_$unique" > > if { [winfo exists $w] } { > @@ -789,7 +795,7 @@ > set buttonName [lindex $button 0] > set buttonLabel [lindex $button 1] > button $w.buttons.$buttonName -text $buttonLabel > -command [list set customMessageBoxAnswerTracker($unique) $buttonName] > - pack $w.buttons.$buttonName -pady 0 -padx 0 -side right > + pack $w.buttons.$buttonName -pady 0 -padx 3 -side right > } > > #Pack frames > @@ -1520,8 +1526,7 @@ > set t1 [expr {$secleft % 60 }] ;#Seconds > set secleft [expr {int($secleft / 60)}] > set t2 [expr {$secleft % 60 }] ;#Minutes > - set secleft [expr {int($secleft / 60)}] > - set t3 $secleft ;#Hours > + set t3 [expr {int($secleft / 60)}] > ;#Hours > set timeleft [format "%02i:%02i:%02i" > $t3 $t2 $t1] > } > > @@ -1587,10 +1592,7 @@ > > #Converts filesize in KBytes or MBytes > proc sizeconvert {filesize} { > - #Converts in KBytes > - set filesizeK [expr {int($filesize/1024)}] > - #Converts in MBytes > - set filesizeM [expr {int($filesize/1048576)}] > + set filesizeM [expr {int($filesize/1048576)}] ;#Converts in > MBytes > #If the sizefile is bigger than 1Mo > if {$filesizeM != 0} { > set filesizeM2 [expr {int((($filesize/1048576.) - > $filesizeM)*100)}] > @@ -1599,8 +1601,11 @@ > } > set filesizeM "$filesizeM,$filesizeM2" > return "${filesizeM}M" > - #Elseif the filesize is bigger than 1Ko > - } elseif {$filesizeK != 0} { > + } > + > + #Elseif the filesize is bigger than 1Ko.Converts in KBytes > + set filesizeK [expr {int($filesize/1024)}] > + if {$filesizeK != 0} { > return "${filesizeK}K" > } else { > return "$filesize" > @@ -7649,14 +7654,13 @@ > } > } > > - proc GetChatId { user } { > - set chatid $user > - set win [::ChatWindow::For $chatid] > - if {$win != 0 && [winfo exists $win] } { > - return $chatid > - } else { > - return 0 > - } > + proc GetChatId { chatid } { > + set win [::ChatWindow::For $chatid] > + if {$win != 0 && [winfo exists $win] } { > + return $chatid > + } else { > + return 0 > + } > } > > } > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Amsn-devel mailing list > Amsn-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amsn-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Amsn-devel mailing list Amsn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amsn-devel