Divider gadget?

BlitzMax Forums/MaxGUI Module/Divider gadget?

JoshK(Posted 2006) [#1]
Any idea how I can make a divider? Is there an actual windows control for this, or are they always hacks? I'd prefer not to use a canvas to handle this, since I think that's a cheesy method.

See the bottom of this image:



SebHoll(Posted 2006) [#2]
Hi,

You can use the divider style (LABEL_SEPARATOR) of the Label gadget, see the MaxGUI documentation... Example:

' createlabel.bmx

Strict 

Local window:TGadget

window=CreateWindow("My Window",30,20,320,480)

CreateLabel("",10,220,280,54,window,LABEL_SEPARATOR)

While WaitEvent()<>EVENT_WINDOWCLOSE
Wend


Seb


JoshK(Posted 2006) [#3]
Thanks, I just found the LABEL_SEPARATOR flag.

I added a tweak to get a 2-pixel-high divider, instead of the default box:
Strict 

Local window:TGadget
Local label:TGadget
Local hwnd

window=CreateWindow("My Window",30,20,320,480)

label=CreateLabel("",10,220,280,54,window,LABEL_SEPARATOR)

hwnd=QueryGadget(label,QUERY_HWND)
SetWindowPos hwnd,0,0,0,label.width,2,SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE

While WaitEvent()<>EVENT_WINDOWCLOSE
Wend


Hmmmmm...as soon as the user resizes the window, Blitz resizes the divider to make a box, even if the layout is set to the top-left corner. How can I make the divider remain the height I want it? Adding a hook and putting all my dividers into a list seems a little excessive for something this simple.

I can also create a parent panel 2 pixels high, and create the separator in this panel, so only the top 2 pixels are visible. Kind of a hack, but it works for now.


Brucey(Posted 2006) [#4]
You can use SetGadgetLayout to lock the gadget dimensions (or have it scale when the window resizes, etc.)


JoshK(Posted 2006) [#5]
Hmmmmm...as soon as the user resizes the window, Blitz resizes the divider to make a box, even if the layout is set to the top-left corner.



skidracer(Posted 2006) [#6]
SetGadgetLayout uses a combination of 4 sides, anchored or averaged, the maxide source features a splitter which demonstrates. By no means my finest hour but i remember a lot of fiddling to get them right, you add the splitter to the same parent as your two panels, it resizes them filling the parent client area with a combination of the three chidren gadgets in total. The flip option reverses the sides of the two panels (navbar on left option in maxide).




JoshK(Posted 2006) [#7]
That wasn't what I was asking about, but nice splitter!


Brucey(Posted 2006) [#8]
I guess this is the problem :
void Win32Label::setShape( int x,int y,int w,int h ){
	if ((GetWindowLong(_gadget.hwnd(),GWL_STYLE)&SS_TYPEMASK)==SS_ETCHEDFRAME) h=4;
	_gadget.setShape(x,y,w,h);
	BBLabel::setShape(x,y,w,h); 
}

...where it sets height to 4. Changing it to 2 makes it work properly on my win2k box. However it might depend on the theme in use.


Boulderdash(Posted 2006) [#9]
Thanks Skidracer, that splitter code is just what I was looking for,

Im putting it in now!


Boulderdash(Posted 2006) [#10]
Just paste'd the code in, now I have a splitter


Scott Shaver(Posted 2006) [#11]
Skidracer, thanks for the splitter code.


RustyKristi(Posted 2015) [#12]
Hi, Is there a version for WinBlitz3D to use this Divider gadget?


jsp(Posted 2015) [#13]
I don't know if someone created a similar function in Blitz3D, but Blitz3D does not have a GUI module.
Here this gadget is generated using the native GUI gadgets from the OS (Win, Mac , LInux).
So if you look for exactly the same, it's probably not available.


RustyKristi(Posted 2015) [#14]
Thanks jsp, yes it's called WinBlitz3D and I have read here that they already have full integration with Windows GUI (at least).

http://www.blitzbasic.com/Community/posts.php?topic=54697


jsp(Posted 2015) [#15]
Oh, I see. Didn't know that someone created already a lib for it.

Unfortunately the link to download a demo in the URL you posted is dead (and all other links as well).

So, the project seems quite dead then. I looked also in the German forum.

I assume you have to code it all yourself.


RustyKristi(Posted 2015) [#16]
Hey jsp. Yes, I thought it was code archived for good here. Anyway here's a link of the copy from virtland:

https://www.dropbox.com/s/dkxdqz8u5xry5mv/winblitz3d.zip

I got that from the latest download request here:

http://www.blitzbasic.com/Community/posts.php?topic=100888

thanks