gridLayout doesnt support scrollbar feature which layout can I use for maya cmd modul

I was working on a project unaware that gridlayout doesnt shows scrollbar, so when the number of items increases they are not not shown up properly is their any control from layout i can use to put scrolllbar if number of items coming from list increases, i tried using scrollLayout with grid layout but that doesnt serves the purpose


 maya.cmds.gridLayout(self._poseGrid, e=True,bgc=(0.2,0.2,0.2),cr=True, h=200,vis=False)    
    for pose in self.poseImport.list(): 
        cmd=partial(self.applyPose,pose)          
        maya.cmds.iconTextButton(parent =self._poseGrid, style='iconAndTextVertical',width=self._iconSize[0],                                          height=self._iconSize[1], image1=pose.thumb, label ='%s' %(pose.name),  command = cmd)                                              
       
       
       maya.cmds.gridLayout(self._poseGrid,e=True,vis=True)

import maya.cmds as cmds 
import maya.OpenMayaUI as mui
from PyQt4 import QtGui, QtCore, Qt
import sip

def getMayaWindow():
	ptr = mui.MQtUtil.mainWindow()
	return sip.wrapinstance(long(ptr), QtCore.QObject)

class scrollExample(QtGui.QMainWindow):
	def __init__(self,parent=getMayaWindow()):
		super(scrollExample, self).__init__(parent)		
		
		self.topWidget = QtGui.QWidget()
		self.gridLayout = QtGui.QGridLayout(self.topWidget)
		self.uberScrollArea = QtGui.QScrollArea(self.topWidget)
		self.setCentralWidget(self.topWidget)
		#
		self.uberScrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
		self.uberScrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
		self.uberScrollArea.setWidgetResizable(False)
		self.uberScrollWidget = QtGui.QWidget()
		self.uberScrollWidget.setGeometry(QtCore.QRect(0, 0, 2000, 1000))
		#
		self.uberScrollArea.setWidget(self.uberScrollWidget)

		self.gridLayout.addWidget(self.uberScrollArea, 0, 0, 1, 1)

myscrollExample = scrollExample()
myscrollExample.show()	
	

[QUOTE=bergj;19087]


import maya.cmds as cmds 
import maya.OpenMayaUI as mui
from PyQt4 import QtGui, QtCore, Qt
import sip

def getMayaWindow():
	ptr = mui.MQtUtil.mainWindow()
	return sip.wrapinstance(long(ptr), QtCore.QObject)

class scrollExample(QtGui.QMainWindow):
	def __init__(self,parent=getMayaWindow()):
		super(scrollExample, self).__init__(parent)		
		
		self.topWidget = QtGui.QWidget()
		self.gridLayout = QtGui.QGridLayout(self.topWidget)
		self.uberScrollArea = QtGui.QScrollArea(self.topWidget)
		self.setCentralWidget(self.topWidget)
		#
		self.uberScrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
		self.uberScrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
		self.uberScrollArea.setWidgetResizable(False)
		self.uberScrollWidget = QtGui.QWidget()
		self.uberScrollWidget.setGeometry(QtCore.QRect(0, 0, 2000, 1000))
		#
		self.uberScrollArea.setWidget(self.uberScrollWidget)

		self.gridLayout.addWidget(self.uberScrollArea, 0, 0, 1, 1)

myscrollExample = scrollExample()
myscrollExample.show()	
	

[/QUOTE] well i have done it in maya cmd module … is it possible in PyMel then ?

thanks for effort i figured out, used tablayout and made rowColumnLayout its child with it being having nc=len(list()) gives scrollbar to tabLayout…

Can’t you just put your gridLayout inside a scrollLayout? That’s the way I’ve set up a pose grid UI before and it works pretty nicely. The scrollLayout also has the benefit that it has a resize callback which you can use to update the number of columns in the gridLayout if you need that.

I believe that the shelfLayout also used to do what you are looking for. It used to support multi-line height and you could put icon buttons into it and it would scroll if needed. Although, if I remember rightly in 2011 multi-line shelfLayouts didn’t work any more. I don’t know whether that is still true in newer versions or not though. You could have a look at the old MEL version of poseMan for an example of a shelfLayout used like this. If you try it out in your version of Maya and you get a single line then you’ll know it’s still broken :P.

yes the first option works fine, things usually don’t work when mind is not cool …