Archived

This topic is now archived and is closed to further replies.

castor

4-way-splitter

Recommended Posts

castor    122
i''m using cbuilder5 and opengl. i would like to create four views(perspective+ortho[1,2,3]) to show the model. (something like that http://www.gamedev.net/reference/articles/article1358.asp ) the default splitter control is useless, bc. i can use 2 max. 3 viewports. (one horizontal and one vertical split) anyone knows if there is a good freeware control to make this possible?

Share this post


Link to post
Share on other sites
Dredge-Master    175
you can have as many as you want to.

I made a small http browser using 7 splitters and multiple OpenGL windows.

For your OpenGL windows, place them in a Tpanel, makes them easy to manage aswell.


PS - it is faster to use a stencil for OpenGL than multiple viewport windows.



Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites
castor    122
1.
yes. but it don''t looks right.

2.
i allready use TPanel as rendering context.

3.
when i use stencil buffer it only gets more complicated to manage the "windows" (resizing,...). currently speed is not the problem.

Share this post


Link to post
Share on other sites
risingdragon3    382
Um. Dunno if such a thing exists! Well, what I would do, is write a descendant from TPanel that setups a 4 TPanel children, overload the Paint() function, then draw the splitters. Also, capture clicks in the regions, and do that.
It shouldn''t be too difficult. What''s wrong with the default splitter? It looks ok to me =P

------------------------------
BCB DX Library - RAD C++ Game development for BCB

Share this post


Link to post
Share on other sites
Dredge-Master    175
I see what you are getting at

you mean you want a panel which is changed like a big cross


In that case you only need three splits

split one vertically

Now split each horizontally.

Link both horizontal ones together so they are always at the same height.


Bingo, your splitter is done.

Share this post


Link to post
Share on other sites
castor    122
>>Dredge-Master
YES, that is exactly what i want to have. thanks.

but i don''t know how to "LINK" the horizontal ones together.
i''ve tried to set the Top property in the OnMoved Event. but
it seems to be read only (also can''t set it in OnFormCreate).

i `ll explain what i would like to have:

1.as you allready said a "cross splitter". (LINK prob)

2.the positions of the splitter need sometimes to be set manual (code).
e.g. to save/load the positions from file (so the user don''t have to align the views every time).
that also would be usable to maximize one view forth/back.

any thoughts??

Share this post


Link to post
Share on other sites
Dredge-Master    175
You might aswell start a new project to see what I did first, that way you wont screw yours up. If not, atleast back up your project first.




Okay, firstly I started with the two panels and a vertical splitter





In each of these windows I placed two more panels and a horizontal splitter in each. I had the top two as panel3 (top left) and panel4 (top right). These are the panels that are aligned to top , the other two (bottom two) are the client panels. See the image (and squint as I shrunk it down). This is the completed form.





Now select the two top panels, and go to their events tab on the oject inspector. in the OnResize , ad a function, I called mine SplitterResize and press enter.
This is what your screen should look kind of like.





Last step is the code. Go back to your code (unit1.cpp if its a new form) and add in this code.
It checks to see which side moved, then it makes the other side the same height.


  
if(Sender==Panel4)
Panel3->Height=Panel4->Height;
else
Panel4->Height=Panel3->Height;





Hope that helped you.

Seeya,
James.



Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites
Dredge-Master    175
Oh and to set the splitter height at run time, just save the first panel (panel3) dimension.

When the form loads, set the first panel (panel3) to that height and width, then also set the other panel (panel4) to the same height, or call the function SplitterResize(panel4). Either will work fine (although setting the height is the best thing to do)

So lets say in your

FormLoad (or whatever it is called)

you have code like

in=fopen("mysavedstuff.dat");
ReadSetupData(in);
Panel3->Height=setupdata.height;
Panel4->Height=setupdata.height;
Panel3->Width=setupdata.width;
fclose(in);


(as a note, a better way is to condense the lines to)
in=fopen("mysavedstuff.dat");
ReadSetupData(in);
Panel3->Height=Panel4->Height=setupdata.height;
Panel3->Width=setupdata.width;
fclose(in);

Edited by - Dredge-Master on January 22, 2002 8:22:30 AM

Share this post


Link to post
Share on other sites
castor    122
wow, big thanks for the great reply!

it works 99% right.
i''ve done what you have suggested.
and all works, exept setting the panel width.

e.g.
Panel3->Width is 100;
in OnCreate i set Panel->Width=200;
but that has no effect, it stays the same as in the CBuilder IDE.

(so the manual setting of the vertical splitter don''t work!!)

i hope you have an answer on this.

i''m so close to getting it right, so there must be an answer :-)

Share this post


Link to post
Share on other sites
MButchers    123
Hello there,

instead of using glStencil use glScissor its faster!

you also need to size the panel which is not aligned to
the client ( sizing the one aligned to the client will
have no effect! )

Mark

Edited by - MButchers on January 23, 2002 4:49:52 AM

Share this post


Link to post
Share on other sites
castor    122
"sizing the one aligned to the client will
have no effect!"

thnks for that hint!
i''ve now figured out, how to do it right.
i need to resize panel1.

thnks to all who helped me.

Share this post


Link to post
Share on other sites
Dredge-Master    175
quote:
Original post by MButchers
Hello there,

instead of using glStencil use glScissor its faster!

you also need to size the panel which is not aligned to
the client ( sizing the one aligned to the client will
have no effect! )

Mark



If you do it like I stated above, then they are already aligned.

The first set of overpanels is already aligned to the top of each panel.

All Client aligned panels auto resize.


Think about, or atleast try it before posting next time.




Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites