shouldn’t this work?my button doesnt scroll
self.mainFrame = DirectFrame(frameColor=(0,0,0,1) , frameSize=(-0.5,0.8,-0.8,0.8 ))
self.mybar = DirectScrollBar(parent = self.mainFrame , range=(0,100), value=50, pageSize=3, orientation= DGG.VERTICAL)
self.client = DirectButton(parent = self.mainFrame, text = ("test"), scale=.05)
All you have done is created a frame and put a scroll bar within it. The scroll bar is not hooked up to anything and won’t automatically scroll the frame unless you program it to.
Maybe you meant to create a DirectScrolledFrame instead, which creates its own scroll bars and hooks them up for you automatically. To use a DirectScrolledFrame, you specify the size of the canvas (which is the virtual canvas that holds your buttons) and parent your buttons to frame.canvas instead of directly to frame.
ok, but then how i access scrollbars from scrollframe? just want to make them look nicer?
Have you read the manual page on DirectScrolledFrame?
oh missed this
“Parameters to control the look of the vertical scroll bar”
i create some menu object that makes frame and content. when user navigates it destructs created menus, and creates new.
i have this class for for options menu something like this;
self.mainFrame = DirectScrolledFrame(canvasSize = (-0.45,0.75,-2,2), frameSize=(-0.5,0.8,-0.8,0.8 ))
self.test = DirectButton(parent = self.mainFrame.getCanvas(), text = ("test"), scale=.05)
but when i call destructor i throws me an exception:
Exception exceptions.AttributeError: "'DirectScrolledFrame' object has no attribute 'verticalScroll'" in <bound method OptionsMenu.__del__ of <__main__.OptionsMenu instance at 0x06A11DC8>> ignored
and how to suppress keys and mouse? im doing like so:
self.mainFrame = DirectFrame(frameColor=(0,0,0,1) , frameSize=(-1.2,-0.6,0.9,-0.2 ),suppressKeys = 1, suppressMouse = 1 )
but this dosnt work maybe im doing something wrong?
The destructor works for me. Perhaps you’re double-destructing your frame? You should understand that any frame (or any other DirectGui object) will automatically be destroyed when its parent DirectGui object is destroyed, so maybe this is happening to your frame, and then you’re destroying it again?
“suppressKeys” and “suppressMouse” are designed to prevent the mouse and key events from being sent to gui objects behind the frame. What effect are you looking for when you say “suppress keys and mouse”?
it seems that was double destructor. so when i assing object to var and then assign other obj to that var, phyton calls destructor of the first one. quite cool dont have to clean that garbage i left
if suppresing means that if i do something with mouse on frame and my char would not move, then its not working for me
That isn’t what it means. You can program that kind of suppression yourself.
Thanks for the help, i think now i got all the classes that i need, next step is to connect everything :S