Following Sample exhibits the behaviour!
File 1 - MainMenu.py :-
# -*- coding: utf-8 -*-
import dabo
dabo.ui.loadUI("wx")
import dabo.dEvents as dEvents
from DetailForm import DetailForm
class MainMenu(dabo.ui.dForm):
def afterInit(self):
self.super()
self.Caption = "Test Menu"
self.Size = (300, 320)
self.BorderResizable = False
self.ShowMaxButton = False
self.basePanel = dabo.ui.dPanel(self)
self.Sizer.append1x(self.basePanel)
self.btn1 = dabo.ui.dButton(self.basePanel, Left=10, Top=25, RegID="btn1",
Width=130, Caption="Not Implemented")
self.btn2 = dabo.ui.dButton(self.basePanel, Left=155, Top=25,
RegID="btn2",
Width=130, Caption="Detail Form")
def onHit_btn1(self, evt):
self.notImplemented()
def onHit_btn2(self, evt):
frm = DetailForm(self)
self.hide()
frm.show()
def afterSetMenuBar(self):
self.createMenu()
def createMenu(self):
mb = dabo.ui.dMenuBar()
fm = mb.insert(1,"File")
hm = mb.insert(2,"Help")
fm.append("Quit",OnHit=self.fileMenuQuitHit)
self.MenuBar = mb
def fileMenuQuitHit(self,evt):
self.close()
def notImplemented(self):
dabo.ui.info("Not implemented yet.")
def main():
app = dabo.dApp()
app.MainFormClass = MainMenu
app.start()
if __name__ == '__main__':
main()
File 2 - DetailForm.py
# -*- coding: utf-8 -*-
import dabo
dabo.ui.loadUI("wx")
import dabo.dEvents as dEvents
class DetailForm(dabo.ui.dForm):
def afterInit(self):
self.super()
self.BorderResizable = False
self.ShowMaxButton = False
self.Caption = "Detail Form"
self.Size = (260, 210)
self.basePanel = dabo.ui.dPanel(self)
self.Sizer.append1x(self.basePanel)
self.btn1 = dabo.ui.dButton(self.basePanel, Left=10, Top=10, RegID="btn1",
Width=40, Caption="Test It!")
def beforeClose(self, evt):
parent = self.Parent
if parent != None:
parent.show()
def onHit_btn1(self, evt):
dabo.ui.info("Testing 1-2-3.")
def main():
app = dabo.dApp()
app.MainFormClass = DetailForm
app.start()
if __name__ == '__main__':
main()
Regards
Rodgy
----- Original Message -----
From: "Paul McNett" <[email protected]>
To: "Dabo Users list" <[email protected]>
Sent: Tuesday, January 20, 2009 6:26 AM
Subject: Re: [dabo-users] Is this a bug?
> Roger Lovelock wrote:
>> Hi,
>> I've observed some unusual behaviour with dabo that doesn't seem
>> right!
>> 1/ I have a form with buttons acting as a 'Switchboard' menu. The buttons
>> have Regids such as button1, button2 etc. nb All these forms are in code
>> rather than cdxml files.
>> 2/ All the buttons bar one currently simply call a routine (within the
>> same class) which displays a message box "Not Currently Implemented" (nb
>> this is the only place this code exists).
>> 3/ One button does call another form (and makes the first form invisible)
>> which is a simple CRUD form which has navigation buttons. These also have
>> Regids of button1, button2 etc and call self.prior() etc etc.
>> 4/ Both the first and second form have routines called 'onHit_button1'
>> etc
>> 5/ When I run the application and click on the button to load the second
>> form from the first all works OK the first form becomes invisible and the
>> second appears - if I then navigate between records on the second form
>> the navigation works correctly and then the message box 'Not Currently
>> Implemented' gets displayed ie the code on the first form for the first
>> forms button 1 gets executed after the code on the second form for its
>> button 1.
>> 6/ I have assumed that Regids just had to be unique per form and that
>> code invoked via a Regid would be the code within the current form
>> (object) - is this not correct?
>> 7/ I have worked around it by giving all my buttons meaningful (and
>> application unique) Regids (and therefore can't give you the code sample
>> now) - but I would have thought that this was incorrect behaviour.
>>
>> Perhaps I have a conceptual problem here - any thoughts?
>
> RegID's need to be unique per form, not per app. If you could give us a
> small
> runnable sample that shows this behavior, we could fix it. I haven't ever
> seen this
> problem, by the way.
>
> Paul
>
[excessive quoting removed by server]
_______________________________________________
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/e9c99aa797b04060a431e07790353...@roger