[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Some questions about SWT


    Hi all!


Please answer on some question about SWT components.


1.  I  have 2 Views(not Dialogs) and one of them contains button "fButton" on it. And I handle the pressing on fButton event by such code in the viewer:

fButton.addSelectionListener(new SelectionListener() {
                             
            public void widgetDefaultSelected(SelectionEvent e) {}                            
                        public void widgetSelected(SelectionEvent event) {
                                 
                    // some "fButton" actions

                           }
                       });




Another View do something when "Enter" key pressed and the problem is that at the same time first View think that fButton is pressed and do "some "fButton" actions".   How can I avoid this problem? How first View(and/or its button) can "understand" that "Enter" pressing conserns another View?


2.  I have a View with a TextViewer on it. I start some process and during its execution some information posts into TextViewer. Such snippet of code makes it:

          {
     
            ......
            TextViewer tw = ...;
       
                Display display = tw.getControl().getDisplay();              
     
                display.asyncExec(new Runnable() {
                                public synchronized void run() {
                            setDocument();        
                                }
                });        
            ..........

   }        

   

    public void setDocument() {
       TextViewer tw = ...;
       
       tw.setDocument(doc);                    
    }

   This way works more slowly than, for example, Console view works.

   Moreover I want to change color of the text. I didn't manage to do that in mentioned above code.  I tried to insert string "tw.setTextColor(c);"("c" - some Color) anywhere in that code but some Exception always occurs. What should I do to change color text in TextViewer?

   And last question - I want the TextViewer to show last strings of the text everytime. That is, when some information puts to Viewer it must show it and earlier information can be accessed by scrolling up. How can I do it?


 Great Thanks in Advance,

 Igor S. Zamyatin
 Interstron Ltd.
----------------------------------------
email:  isz@xxxxxxxxxxxxx
tel:    +7 (095) 269-4713
cell:   +7 (902) 659-5838
www:    http://www.interstron.ru