Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] mouse wheel

"SWT has no mouse wheel specific events.  The mousewheel events are 
translated into scrolling events in the operating system and reported by 
SWT as scrolling events in the ScrollBars."

If there is no vertical scrollbar but there is a horizontal scrollbar, the 
horizontal scrollbar should be scrolled by the mouse wheel.  If there is 
neither a vertical nor a horizontal scrollbar, then a widget in the parent 
heirarchy is found that has a scrollbar.  If no one has a scrollbar then 
the mouse wheel event is ignored.




Arnaud De Muyser <ademuyser@xxxxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
09/23/2004 02:31 AM
Please respond to
platform-swt-dev


To
platform-swt-dev@xxxxxxxxxxx
cc
Eric Miravete <MIRAVETE@xxxxxxxxxx>
Subject
RE: [platform-swt-dev] mouse wheel







Hi, 
Thanks for those interesting  informations.  I've need further 
information: 
It appears that mouse wheel event are translated into scrolling events 
only for vertical scrollbar ? 
If my canvas have no vertical scrollbar, but an horizontal, mouse wheel 
doesn't scroll anything. 
On second hands, as their are translated to scrolling events in same way 
as use click on top/bottom 
button of scroll bar there are no way to differenciate mouse wheel events 
to scrolling events. 
I mean if I want to use mouse wheel events to zoom in/out rather than 
scrolling ... add a listener to scrollbar will not help me 
is this is true ? 

Thanks for enlightment, 
Arnaud. 



"Pereira Sieso, Rafael" <rpereira@xxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 
09/22/2004 09:15 AM 

Please respond to
platform-swt-dev


To
<platform-swt-dev@xxxxxxxxxxx> 
cc

Subject
RE: [platform-swt-dev] mouse wheel








thack you Veronika, it works fine.
I,m using the value 16777217 for event.detail to know if the mouse wheel 
is up o down, are there any SWT constant for this?.



-----Mensaje original-----
De: platform-swt-dev-admin@xxxxxxxxxxx
[mailto:platform-swt-dev-admin@xxxxxxxxxxx]En nombre de Veronika Irvine
Enviado el: lunes, 20 de septiembre de 2004 14:53
Para: platform-swt-dev@xxxxxxxxxxx
Asunto: RE: [platform-swt-dev] mouse wheel


The canvas widget needs to take focus before it can respond to the mouse 
whell because the mousewheel events go to the widget with focus.  In order 

to make your canvas take focus, you need to add a key listener or a 
traverse listener.  The following works for me.

public static void main (String [] args) {
       Display display = new Display ();
       Shell shell = new Shell (display);
       shell.setLayout(new FillLayout());

       Button b = new Button(shell, SWT.PUSH);
       b.setText("Hello");

       Canvas a_Canvas = new Canvas(shell, SWT.H_SCROLL | SWT.V_SCROLL);
       a_Canvas.addKeyListener(new KeyAdapter() {}); // makes canvas 
accept focus
       ScrollBar scrollHor = a_Canvas.getHorizontalBar();
       ScrollBar scrollVer = a_Canvas.getVerticalBar();
       scrollVer.addSelectionListener( 
                   new SelectionListener()
                       {
                       public void widgetSelected( SelectionEvent evt) 
                                       {
                                       System.out.println("  **** 
VERTICAL SCROLLBAR WIDGETS_SELECTED");
                                       }
                       public void widgetDefaultSelected( SelectionEvent 
evt)
                                       {
                                       System.out.println("  **** 
VERTICAL SCROLLBAR WIDGETS_DEFAULT SELECTED"); 
                                       }
                       }
             );
       shell.open ();
       while (!shell.isDisposed ()) {
               if (!display.readAndDispatch ()) display.sleep ();
       }
       display.dispose ();
}




"Pereira Sieso, Rafael" <rpereira@xxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
09/20/2004 03:53 AM
Please respond to
platform-swt-dev


To
<platform-swt-dev@xxxxxxxxxxx>
cc

Subject
RE: [platform-swt-dev] mouse wheel






Thanks for the help.
I have try to use the scrollbar in a Canvas and add the SelectionListener 
to the scrollbars ( see the code below ).
I only obtained an anwser of the scroolbar listener when I clicked the 
left and right mouse buttons on it but nothing when i clicked or moved the 

mouse wheel.
¿Any idea to obtain an anwser of the mouse wheel?
Thank you in advance.

Rafael.

   a_Canvas = new Canvas(panel, 0x140b00);              // scroll
   a_Canvas.getHorizontalBar().setVisible(true);
   a_Canvas.getVerticalBar().setVisible(true);

   ScrollBar scrollHor = a_Canvas.getHorizontalBar();
   ScrollBar scrollVer = a_Canvas.getVerticalBar();
   scrollVer.addSelectionListener( 
                   new SelectionListener()
                       {
                       public void widgetSelected( SelectionEvent evt) 
                                       {
                                       System.out.println("  **** 
VERTICAL SCROLLBAR WIDGETS_SELECTED");
                                       }
                       public void widgetDefaultSelected( SelectionEvent 
evt)
                                       {
                                       System.out.println("  **** 
VERTICAL SCROLLBAR WIDGETS_DEFAULT SELECTED"); 
                                       }
                       }
             );






-----Mensaje original-----
De: platform-swt-dev-admin@xxxxxxxxxxx
[mailto:platform-swt-dev-admin@xxxxxxxxxxx]En nombre de Veronika Irvine
Enviado el: jueves, 16 de septiembre de 2004 17:52
Para: platform-swt-dev@xxxxxxxxxxx
Asunto: Re: [platform-swt-dev] mouse wheel


SWT has no mouse wheel specific events.  The mousewheel events are 
translated into scrolling events in the operating system and reported by 
SWT as scrolling events in the SrollBars.  See 
ScrollBar.addSelectionListener.




"Pereira Sieso, Rafael" <rpereira@xxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
09/16/2004 02:47 AM
Please respond to
platform-swt-dev


To
<platform-swt-dev@xxxxxxxxxxx>
cc

Subject
[platform-swt-dev] mouse wheel






I am new on using SWT, and I'd like to use the mouse wheel to control 
diferent IHM funtions. Are there any examples to see how to use the mouse 
wheel in SWT ?.

Thank you in advance.

Rafael.
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, 
contiene información de carácter confidencial exclusivamente dirigida a su 


destinatario o destinatarios. Queda prohibida su divulgación, copia o 
distribución a terceros sin la previa autorización escrita de Indra. En el 


caso de haber recibido este correo electrónico por error, se ruega 
notificar inmediatamente esta circunstancia mediante reenvío a la 
dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and 
solely for the attention and use of the named addressee(s). You are hereby 


notified that any dissemination, distribution or copy of this 
communication is prohibited without the prior written consent of Indra. If 


you have received this communication in error, please, notify the sender 
by reply e-mail
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, 
contiene información de carácter confidencial exclusivamente dirigida a su 

destinatario o destinatarios. Queda prohibida su divulgación, copia o 
distribución a terceros sin la previa autorización escrita de Indra. En el 

caso de haber recibido este correo electrónico por error, se ruega 
notificar inmediatamente esta circunstancia mediante reenvío a la 
dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and 
solely for the attention and use of the named addressee(s). You are hereby 

notified that any dissemination, distribution or copy of this 
communication is prohibited without the prior written consent of Indra. If 

you have received this communication in error, please, notify the sender 
by reply e-mail
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, 
contiene información de carácter confidencial exclusivamente dirigida a su 
destinatario o destinatarios. Queda prohibida su divulgación, copia o 
distribución a terceros sin la previa autorización escrita de Indra. En el 
caso de haber recibido este correo electrónico por error, se ruega 
notificar inmediatamente esta circunstancia mediante reenvío a la 
dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and 
solely for the attention and use of the named addressee(s). You are hereby 
notified that any dissemination, distribution or copy of this 
communication is prohibited without the prior written consent of Indra. If 
you have received this communication in error, please, notify the sender 
by reply e-mail
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev




Back to the top