Options for option menu

Before I start coding a custom control, thought I’d ask if DirectOptionMenu has a way to control the size of the popup and a way to scroll through it. I can possibly have a long list sometimes and want to be able to not go over my screen size. (i.e. extend beyond the visible screen).

If it’s meant for smaller lists - I will have to use a DirectSrcollList on a modal dialog, I guess.

Did you try making a panda3d.org/manual/index.php … olledFrame and reparent your menu to the frame canvas with menu.reparentTo(myFrame.getCanvas()) ?
Then if the menu is big for the screen navigate trough the frame with the scrollbars. All the elements of scrolledFrame are customizable.

Hadn’t tried that.
I can easily parent it to a canvas, but I’m not following how I would make it look and work like a std dropdown list (like the “Jump to:” dropdown list at the bottom of this forum.)

Could you (or anyone) post some sample code?

This is an example of directscrolledframe:

import direct.directbase.DirectStart
from direct.gui.DirectGui import *

myframe = DirectScrolledFrame(canvasSize = (-2,2,-2,2), frameSize = (-0.8,0.8,-0.8,0.8))

mybutton = DirectButton(text = ("OK", "click!", "rolling over", "disabled"))
mybutton.reparentTo(myframe.getCanvas())
mybutton.setScale(0.6)

mymodel = loader.loadModel('panda')
mymodel.reparentTo(myframe.getCanvas())
mymodel.setScale(0.1)
mymodel.setX(-0.8)

#background
env = loader.loadModel('environment')
env.reparentTo(render)

run()

EDIT: I must have misread your original question. I dont think this will help

Have you tried specifying popupMenu_frameSize? And other attributes prefixed with popupMenu_ ?

David

No, I haven’t. And that would be the easiest solution! :slight_smile:

I assume I can resize the popup to stay on my screen but would it automatically handle if there are more items in the popup than can be shown in the frame?

Hmm, I don’t know that it will. You might have to write a custom menu to do that.

David

Ah, ok, would i base on optionmenu?

Sounds like a good place to start.

David