Logo Search packages:      
Sourcecode: pythoncard version File versions  Download package

def customDialogs::ChooserDialog::buildChooserResource (   self,
  title,
  caption,
  options,
  defOption 
)

This builds a string containing a resource description as you find in a .rsrc files

Definition at line 217 of file customDialogs.py.

00217                                                                       :
        """This builds a string containing a resource description as you find in a .rsrc files"""

        # dynamically build each of the list choices
        optionsStr = "["
        for opt in options:
            txt = opt.replace("'", "\\'")
#            optionsStr = optionsStr + "'" + opt.replace("'", "\\'") + "',"
            optionsStr = optionsStr + "'" + txt + "',"
        optionsStr = optionsStr + "]"


        # construct the resource string.
        dlgRSRC = "{'type':'CustomDialog','name':'dlgChooser'," + \
                  " 'title':'" + title + "','position':(100,50),'size':(445, 330),\n\n'components': ["
        
        
        dlgRSRC = dlgRSRC + " {'type':'StaticText', 'name':'labelCaption', 'position':(10,10)," + \
                  "'text':'" + caption.replace("'", "\\'") + "'},"

        dlgRSRC = dlgRSRC + " {'type':'List', 'name':'options', 'position':(10,30),'size':(415,200)," + \
                  "'items':" + optionsStr + ",'stringSelection':'" + defOption.replace("'", "\\'") + "'},"

        dlgRSRC = dlgRSRC + \
                  "{'type':'Button', 'name':'btnOK', 'position':(10, 260), " + \
                  "'label':'OK', 'id':5100, 'default':1, 'toolTip':'Update Preferences'}," + \
                  "{'type':'Button', 'name':'btnCancel', 'position':(110, 260)," + \
                  "'label':'Cancel', 'id':5101, 'toolTip':'Discard Preferences Changes' } " + \
                  " ] } "

        # eval the resource string, pass it to Resource() and return it.
        return resource.Resource( eval(dlgRSRC) )
        
    # these shouldn't be necessary ... (see textEditor.pyw)
    def on_btnOK_mouseClick(self, event):


Generated by  Doxygen 1.6.0   Back to index