From: Andy T. <an...@ha...> - 2005-07-25 12:37:57
|
Lucas VERGNETTES wrote: > Hi, > > I'm enjoying a lot using PythonCard, and I'm extending the > gadflyDatabase example for fun. > > One thing I would like to do is to be able to display the 'ID' number > that gadfly uses in the database. > I don't think I can access it with self.components.id .... or with an > SQL query (how to be sure to get the good number when creating a new card?) > > > Thanks for your help, I will post sniplets of code if needed. > > Lucas > > > Lucas VERGNETTES lu...@th... > The gadflyDatabase module works on introspection, so you don't need to write any code at all. It automatically iterates through every field in the Document (database result set) and if it can find a corresponding field in the View (PythonCard background) it stuffs one into the other. In simple terms, a quick modification of the gadflyDatabase sample should just involve editing the resource file (gadflyDatabase.rsrc.py) and adding another component; {'type':'Spinner', 'name':'Id', 'position':(<x>, <y>), }, Where <x> and <y> are the co-ordinates of the position you'd like to see the widget appear. The only restriction is that the type of your widget must either be a 'Spinner' or a 'Slider'. If you want to render it another way you'll need to edit the gadflyDatabase.py module, if you get that far post another message to the list and I'll try and help. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |