[Tutor] Re: [Pythoncard-users] childWindow.Raise() works on Windows, not on Mac

Liam Clarke cyresse at gmail.com
Thu Mar 31 01:20:06 CEST 2005


Hi Brad, 

AFAIK, and Kevin Altis will no doubt correct me if I'm wrong...


Class Parent(model.Background):

def  on_button1_mouseClick(self, event):
     x = model.ChildWindow(self, child.Child)
      x.id_emp = 20


Class Child(model.Background)

      def on_initialize(self, event):
           self.getClient(self.id_emp)



So, from what I understand, the event queue would go like this 

User clicks button1, a new event triggers, which runs the method.
That method creates a new event, Child initialize.

But, the initalise event waits in the queue until the
on_button1_mouseClick finishes.

So that method can take all the time in the world to do what it wants,
and Child will
only initialise when it's done.

Which is why you need to thread GUI stuff that's waits a long time for
something to return to avoid 'hanging', because the screen won't
repaint (which is an event) until the prior event triggered method
finishes.

Make sense? If it doesn't, let me know.



Regards, 


Liam Clarke











On Wed, 30 Mar 2005 17:03:19 -0600, brad.allen at omsdal.com
<brad.allen at omsdal.com> wrote:
>  
> I have a question about this approach. It does work, but I don't understand
> it as well 
> as I'd like and I worry that it depends too much on timing. When does the
> child 
> window's on_initialize run? What if on a really fast computer it runs before
> the 
> childWindow.id_emp is bound?
>  
>  
> pythoncard-users-admin at lists.sourceforge.net wrote on 03/21/2005 03:55:47
> PM:
> 
>  
>  > Hi Brad, 
>  > 
>  > You need to put the raise method in a method of  the  childWindow.
>  > I'm on XP, and calling the childWindow's raise method from the
>  > originating method as above never works for me.
>  > 
>  > i.e.
>  > 
>  > def on_empMultiColumnList_itemActivated(self, event): 
>  >    #Do stuff to derive id_emp
>  >    childWindow = model.childWindow(self, empDetail.bgEmpDetail) 
>  >    childWindow.id_emp = id_emp
>  >     
>  > 
>  > and in empDetail - 
>  > 
>  > class bgEmpDetail(model.Background):
>  >           def on_initialise(self, event):
>  >                 #This will need explaining
>  >                 self.popuulateFields(self.id_emp)
>  >                 self.Raise()
>  > 
>  > See, what happens is that when a child window is created, the method
>  > that created finishes before the child window's on_initialise gets
>  > called.
>  > 
>  > At the mo, my thing with childWindow.id_emp = id_emp is the only way
>  > of passing other parameters to the on_initialise() method.
>  > 
>  > So, you can pass the parameters in, and then your child windows
>  > initialisation can act on them.
>  > 
>  > And, sticking Raise() in the child windows init method fixed your
>  > problem for me.
>  > 
>  > 
>  > I hope it helps. If it's confusing at all, let me know and I'll try
>  > and explanify further.
>  > 
>  > 
>  > Regards, 
>  > 
>  > Liam Clarke
>  >  
>  > 
>  > 
>  > On Mon, 21 Mar 2005 11:11:40 -0600, brad.allen at omsdal.com
>  > <brad.allen at omsdal.com> wrote:
>  > >  
>  > > The Raise method for a child window seems not to work on the Mac, but
> does
>  > > work under Windows. On the Mac, the child window starts to pop in front
> of
>  > > the parent window, but then it withdraws behind. From looking at
> message
>  > > watcher, It's almost as if the second click in my doubleclick is
> bringing
>  > > the parent window forward. 
>  > >  
>  > > Is there something else I should be doing other than Raise(), or is
> this a
>  > > bug? 
>  > >  
>  > > Here is the method runs when I doubleclick my multicolumnlist:
>  > >  
>  > >         def on_empMultiColumnList_itemActivated(self, event): 
>  > >                 """When an entry is double clicked""" 
>  > >                 indexClicked = event.m_itemIndex 
>  > >                 base = self.components 
>  > >                 rows = base.empMultiColumnList.GetSelectedItems() 
>  > >                 if len(rows) == 0: 
>  > >                         return 
>  > >                 print rows 
>  > >                 id_emp = rows[0][0] 
>  > >                 empDetail.id_emp = id_emp 
>  > >                 self.detailWindow =
>  > > model.childWindow(self,empDetail.bgEmpDetail) 
>  > >                 self.detailWindow.populateFields(id_emp) 
>  > >                 self.detailWindow.Raise()         
>  > >  
>  > >  
>  > > I'm running PythonCard .81, wxPython 2.5.4.1, Python 2.3, Mac OS
> 10.3.8.    
>  > >     
>  > 
>  > 
>  > -- 
>  > 'There is only one basic human right, and that is to do as you damn 
>  > well please.
>  > And with it comes the only basic human duty, to take the consequences.
>  > 
>  > 
>  > -------------------------------------------------------
>  > SF email is sponsored by - The IT Product Guide
>  > Read honest & candid reviews on hundreds of IT Products from real users.
>  > Discover which products truly live up to the hype. Start reading now.
>  > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>  > _______________________________________________
>  > Pythoncard-users mailing list
>  > Pythoncard-users at lists.sourceforge.net
>  > https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>  


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list