Re: Tablelist and tk_messageBox interaction



Jeff Godfrey schrieb:
Hi All,

I'm working on app that relies heavily on Csaba Nemethi's Tablelist widget to display database records. I have a situation where the interaction between the tablelist and a tk_messageBox seem odd to me. I'm not sure if something's broken somewhere (and if so, where), or if this is expected behavior. Here's what's happening (unfortunately, very simple to see, yet somewhat difficult to explain).

First, the tablelist's selectmode is intentionally set to "extended", so that multiple records can be selected. The app is designed so that if the current record has been modified and not saved when a new record is selected, a tk_messageBox is opened to warn the User and allow them to save the record before continuing to the newly selected record. Under normal circumstances this works as intended, except if the User does a "drag" operation during the selection of the new record. In this case, here's what happens...

1. The new record is selected with a mouse press event (but the button isn't released)
2. The app detects an unsaved record and opens the tk_messageBox in the foreground
3. As long as the mouse button hasn't been released, it's still possible to drag-select multiple record in the tablelist prior to responding to the messageBox - which is what I don't want.


Once the mouse button (pressed in #1) is released, the entire app is effectively "blocked" until the message box is handled by the User. I'd like the multi-select drag operation to blocked until the message box is handled also. I hope that made *some* sense... ;^)

So, does this indicate a problem somewhere (tablelist? tk_messagebox?), or is this considered normal behavior?

Thanks for any input.


Jeff




This behavior is hardly tablelist-specific, because tablelist widgets handle the selection exactly in the same way as the Tk listboxes. Have you tried to replace the tablelist with a listbox widget? I am pretty sure that your script will expose the same behavior.


Unfortunately, I don't have access to my Windows XP notebook right now, but I have tried to reproduce your problem on Linux and Mac OS X Aqua, with the following two scripts:

Script #1 (using a tablelist widget):

package require tablelist

toplevel .top
tablelist::tablelist .top.tbl -columns {0 Title} -selectmode extended
..top.tbl insert end 0 1 2 3 4 5 6 7 8 9
pack .top.tbl

bind .top.tbl <<TablelistSelect>> {
    if {[lsearch [.top.tbl curselection] "4"] >= 0} {
        tk_messageBox -icon error -type ok \
            -message "Please save the record first!"
    }
}

Script #2 (using a listbox widget):

toplevel .top
listbox .top.lb -selectmode extended
..top.lb insert end 0 1 2 3 4 5 6 7 8 9
pack .top.lb

bind .top.lb <<ListboxSelect>> {
    if {[lsearch [.top.lb curselection] "4"] >= 0} {
        tk_messageBox -icon error -type ok \
            -message "Please save the record first!"
    }
}

Both scripts behave correctly, on both platforms. That is, once item #4 gets selected, the message box is popped up and immediately grabs the focus, blocking any further selection attempts, until it gets dismissed. Maybe on Windows XP the behavior is different; could you please verify this? Also, can you confirm that these scripts should suffice to reproduce your problem?

--
Csaba Nemethi   http://www.nemethi.de   mailto:csaba.nemethi@xxxxxxxxxxx
.



Relevant Pages

  • Re: SpatialSearch not working on 1D shapes
    ... >I am using the Visio2003 Drawing Control in a .NET windows app. ... > I am using in my app) but returns null when the clicked shape is a one ... > dimensional shape (the 'Transition' shape from the ROOM stencil). ... > Selection foundShapes = currentPage.get_SpatialSearch(clickLocationX, ...
    (microsoft.public.visio.developer)
  • Re: No sound...?
    ... TextEdit - open selected file. ... If I want to open a selected file, ... applicaiton that selection will be passed to the application in the ... That is a bad name - as Import Image is not the name of an app I would ...
    (uk.comp.sys.mac)
  • Re: I am using the DIRLISTBOX in VB 6..Need it to show hidden directories. I cant find a way for it
    ... >> I am using the DIRLISTBOX in VB 6..Need it to show hidden directories. ... I will need to be able to select the share via controls ... >> for Dir location only selection etc. ... This app is going to be used in house, ...
    (microsoft.public.vb.controls)
  • I am using the DIRLISTBOX in VB 6..Need it to show hidden directories. I cant find a way for it to d
    ... I am using the DIRLISTBOX in VB 6..Need it to show hidden directories. ... for Dir location only selection etc. ... I would appreciate any and all help/suggestions as to what controls to ... This app is going to be used in house, ...
    (microsoft.public.vb.controls)
  • Re: Tablelist and tk_messageBox interaction
    ... can you confirm that these scripts> should suffice to reproduce your problem? ... additional records in the main app even while the message box is open. ... Interestingly, in your test scripts, each additional record that is added to the selection triggers another message box to open, so it's easy to stack a bunch of them on the screen. ...
    (comp.lang.tcl)