[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Layout

Don't worry about my previous question. Found it. getMaximizedControl()

Another question. I am trying to use Jface ToolBarManger() with Action class to create a tool bar button to toggle the SashForm Maximized control. I passed in the sash form from my MainWindow( extends ApplicationWindow) to the Action class... but when I click on the button, it throw null pointer exception. message said the SashForm is null.... I guess the protected ToolBarManager createToolBarManager(int style) is called before protected Control createContents(Composite parent)... so the SashForm has not been constructed while passed into the Action class...
am I right? Can anybody point me to the right direction?


Cheers
HS



HS wrote:
Hi there,

I am having the same problem. so how did you detect C2's status when the action is triggered(maximum or normal)? I am trying to use one button to toggle it.

Cheers,
Henry


frank Buloup wrote:
Thanks a lot Evelyne,

I've coded your first idea and it is exactly what I want !

I've fixed L to be a FillLayout and it doesn't matter with the parameter (SWT.HORIZONTAL or VERTICAL)
A RowLayout with SWT.HORIZONTAL parameter doesn't look good...


In my opinion Layout are quite difficult to understand... I need to be used with them !

Thanks,
frank


"Evelyne Merle" <dummy@xxxxxxxx> a écrit dans le message de news: ekos04$bu6$1@xxxxxxxxxxxxxxxxxxxx
First idea : If C1 and C2 are same height or same width, and can be resized on user interaction

Use a SashForm instead of composite for C. (take a look at setWeights for objects ratios)
To maximize C2, use SashForm method setMaximizedControl(C2)
To return to initial state, use setMaximized(null)


Second idea : C is managed by a GridLayout (=L)
Use setLayoutData on C1 with GridData and exclude top set to true or false depending on C1 visibility.
When C1 visiblity is changed, set exclude top to the right value dans call layout() on C.
C1 will be excluded from the layout processing.


By the way, which layout is currently under L ?

Evelyne.

"frank Buloup" <buloup@xxxxxxxxxxxxxxxx> a écrit dans le message de news: ekoqqr$9ia$1@xxxxxxxxxxxxxxxxxxxx
Hi,

Imagine you have two composite C1 and C2 in a parent composite C
with a layout L.

C2 has a button with a mouse up listener. This listener is here to toggle visibility
of C1 and to ask L to redraw.


But :
this redraw must force C2 to occupy the all client area of C if C1 visibility
is false or to get previous state if C1 visibility is true.


I have not been able to do that ! It seems to be easy but...

any ideas ?

thanks a lot,
regards
frank