johnf wrote:
> ....
> Ed and Paul are programmers and by definition are lazy (we all are).  So they 
> have created short cuts for many of the things that you'll do daily while 
> programming with Dabo.  There are many so I'll only show two and let you 
> explore/find the others for yourself.  The first deals with sizers.  Recall 
> that when I'm appending to a sizer I have pass two parameters as in:
> 

Note that the entire documentation of object creation ways is missing
in the api docs.
This is one of the worst things of the current api docs.

> Vsizer.append(dabo.ui.dButton(self, Caption='Button'),1,'x') 
> also written as
> Vsizer.append(dabo.ui.dButton(self, Caption='Button'), proportion=1, “expand”)
> 
> You will type the last two parameters (proportion=1 , “expand”) often.  Ed 
> got 
> tried of doing that and created a short cut:
> 
> Vsizer.append1x(dabo.ui.dButton(self, Caption='Button'))  simple right - note 
> the "append1x".  
> 
> The second has to do with binding an event.  In my code I did the following:
> 
> ourButton=dabo.ui.dButton(self,RegID="selectButton",Caption= "...")
> ourButton.bindEvent(dEvents.Hit, self._openDialog)
> hs.append(ourButton,0)
> 
> The easy way and all on one line is as follows:
> hs.append(dabo.ui.dButton(self,RegID="selectButton",Caption= 
> "...",OnHit=self._openDialog),0)
> 
> Notice I added “ OnHit=self._openDialog”.  This does exactly what the other 
> three lines do.  When we get into using bizobjects we will use more short 
> cuts.  Just remember that short cuts are just that – short cuts for typing.  
> They do not change the way the code works.
> 
> 
> The last question was how to fill the textbox with the filename selected in 
> the file dialog.  Here is the code:
> def _openDialog(self,evt):
                import os
>               # need to receive the evt (in this case a click or Hit)
>               evt.stop()
>               theDialog=dabo.ui.dFileDialog(self)
>               theDialog.show()
>               if sys.platform == 'win32':
>                       myseperator = "\\"  # someone should post why I needed 
> two slashes
>               else:
>                       myseperator = "/"
>               
                myseperator = os.path.sep
>               myReturnFileValue= theDialog.FileName
>               myReturnDirectory = theDialog.Directory
>               
>               # recall “filename” is the RegID of the textbox
>               self.filename.Value= myReturnDirectory + myseperator + 
> myReturnFileValue
> 

Nice done John.
People new to Dabo will appreciate these tutorials very much.
Hopefully your posts will get included into the wiki later.

Uwe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to