Re: please help with wx.dialog

"Werner F. Bruhin" <[email protected]>
Newsgroups gmane.comp.ide.boa-constructor.user
Message-ID <[email protected]>
Hi Fernando,

Lets keep going on this list, as it is nicer to include code.

BTW, you should not cross post the same question as mostly the same 
people (some more on the wxPython list then the two Boa lists) read all 
the three lists you posted to.

Fernando Paiva wrote:
> Hello All
>  
> I am facing a problem that can not resolve. I have two wx.Dialog form, 
> their name are: Customer and SearchCustomer
> In the form Customer I have a button that invoke a SearchCustomer form, 
> the SearchCustomer form has a grid that is filled with the results of 
> the consultation
>  
> In the SearchCustomer form, I have a function below.
>     def OnGridSearchCustomerGridCellLeftDclick(self, event):
>         import Customer 
>         customer  = Customer.Customer(self)
>         row = event.GetRow()
>         codeOfCustomer = self.gridSearchCustomer.GetCellValue(row, 0)
>         self.Close()
>         customer.receiveSearch(int(codeOfCustomer))
>  
> In the Customer form, I have a function below.
>     def receiveSearch(self, codeOfCustomer):
>         self.intCtrlCode.SetValue(codeOfCustomer)
if you do a print here are you seeing the correct value?
           print self.intCtrlCode.GetValue()
>         
>         try:
>             _sql = """
>                     SELECT customer_code, customer_name FROM customer 
> WHERE customer_code = %s
>                    """ % (codeOfCustomer)
>             self.cursor.execute(_sql)
>             registers = self.cursor.fetchall()        
>             for x in registers:
>                 self.textCtrlName.SetValue(x["customer_name"])
Here I like to see the following two prints within the for loop:
                   print self.textCtrlName.GetValue()
                   print x["customer_name"]

The above will show you if "x" is really containing what you think it 
has and if there is not by any chance a blank entry in there.
>         except MySQLdb.Error, e:
>             wx.MessageBox("Error %d: %s" %(e.args[0], e.args[1])) 
>  
> When I give a command "print", the values is all right, but the fields 
> "textCtrlName" not update with a Set Value. I don't understand because.
As Kevin pointed out you might need a refresh for both controls.

If above does not help it would be good to do a small self running 
example which we then can correct, however I often found doing the self 
running example I see my own mistake and can fix the problem myself.

Werner


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.