Dataset bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dataset bug

Martial Tarizzo
Hello all,

I tried to use a Dataset with a Combo box Type for a column (nearly
undocumented in the GUI Developer's guide..)
 
As long as I use the mouse, everything works fine. When I use the keyboard
to move between cells or to change values with the combo => bad behaviour or
UE !

Steps :
- load the Dataset1 example

in the GUI painter :
- select the first column (Name) of the Dataset, change the Type to 'Combo
Box' in the 'Column' property page
- in the 'Column Type' property page, put #listNames for 'Choices'
- install the canvas

In the Browser, add the instance method :
listNames
        ^#('aa' 'bb' 'cc') asValue

Now, launch Dataset1Example.
- Keyboard focus is on first cell. Press down arrow, select 'bb' for
example. *Press TAB* => focus goes to cell 2, but cell 1 appears to be
empty. Reselect cell 1 (mouse or keyboard with shift-Tab) => bb in cell 1
...
- Still in cell 1, reselect 'bb' with down arrow. Press TAB => unhandled
exception...

I have found a solution to solve the problem, but I am not sure it is the
way to go...
Here is my workaround : I have overrided openDropDownListWithEvent: in
ComboBoxButtonController, adding some Nil tests and installing a
keyboardHook to de-activate the Tab key when the list of the combo box is
exposed :

(modifications between *******)

openDropDownListWithEvent: event
        "Open the drop down list. The user will be given the opportunity to
        make a selection. If the user makes a selection, set the text in the

        editable text field."

        | selectionList builder listView dropWindowBounds theWindow |

        "***********************"
        (self dropDownIsOpen or: [self view topComponent isNil]) ifTrue:
[^self].
        "***********************"
        selectionList := SelectionInList new.
        selectionList list: self view dropDownListItems.
        builder := UIBuilder new.
        builder policy: self view lookPolicy.
        listView := self newListViewIn: builder selectionList:
selectionList.
        dropWindowBounds := self dropDownWindowBoundsFor: listView.
        theWindow := self
                                newDropDownWindowInBounds: dropWindowBounds
                                eventDriven: true
                                builder: builder
                                model: listView controller closeChannel.
        theWindow lookPreferences: self view widgetState colors.
        "***********************"
        theWindow keyboardProcessor
                keyboardHook: [:evt :ctrl | evt keyValue = Core.Character
tab ifTrue: [nil] ifFalse: [evt]].
        "***********************"
        [theWindow
                openTransientIn: theWindow displayBox
                type: #postedMenu
                postOpen:
                        [view editorView postOpenDropDown.
                        view upcastEvent: #triggerEvent with: #listExposed.
                        listView postOpenDropDown.
                        self dropDownIsOpen: true]]
                        ensure:
                                [self dropDownIsOpen: false.
        "***********************"
                                view topComponent notNil ifTrue: [view
topComponent forceActive].
        "***********************"
                                view editorView controller activate.
                                view upcastEvent: #triggerEvent with:
#listClosed.
                                view isInTransition: false].
        selectionList selectionIndex > 0
                ifTrue: [self takeValue: selectionList selection]



Comments really welcome !

-- Martial