Hi Manuel,

In a dialog I am displaying from a OOBasic script, I'd like to move the
focus on different widgets, using the keyboard arrows. More
specifically, I have two ListBox side-by-side. The one on the left
contains topics, the one on the right is filled dynamicly with relevant
articles, according to the selected topic. The goal here is to use the
keyboard to select a topic and then an article.

[...]
<http://api.openoffice.org/docs/common/ref/com/sun/star/awt/XWindow.html>

The listbox is a css.awt.UnoListBox (
http://api.openoffice.org/docs/common/ref/com/sun/star/awt/UnoControlListBox.html
  ) which includes the service css.awt.UnoControl (
http://api.openoffice.org/docs/common/ref/com/sun/star/awt/UnoControl.html
).

The latter exports css.awt.XWindow ... so the method getFocus() should
be available at every control.

Hello,

Thank you ! I was using oDialog.getByName("Termes").setFocus() instead of
oDialog.getControl("Termes").setFocus(). I can now focus where I want to.

However, I still have a problem. On which event should I bind the
following macro to get the job done : onKeyPress or onKeyReleased ? Both ?
 Based on actual widget selected content, I'd like to update another
widget content before moving focus.

Sub KeyPressedInDialog(Event As Object)
    Dim widget As String
    Dim control As Object
    widget = Event.Source.Model.Name
    Select Case widget
        Case "Domaines"
            Select Case Event.KeyCode
                Case com.sun.star.awt.Key.RIGHT
                    UpdateSelectedTerm
                    Set control = oDialog.getControl("Termes")
                    control.setFocus()
                Case com.sun.star.awt.Key.DOWN
                Case com.sun.star.awt.Key.UP
                    UpdateTermsList
            End Select
        Case "Termes"
            Select Case Event.KeyCode
                Case com.sun.star.awt.Key.LEFT
                    Set control = oDialog.getControl("Domaines")
                    control.setFocus()
                Case com.sun.star.awt.Key.DOWN
                Case com.sun.star.awt.Key.UP
                    UpdateSelectedTerm
            End Select
        Case "remplacement"
            Select Case Event.KeyCode
                Case com.sun.star.awt.Key.RETURN
                    ReplaceAnglicisme
            End Select
    End Select
End Sub

Any idea ?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to