Context Help button issue

I setup a dialog like this:

         self._init_ctrls(parent, style=style|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|
                                 wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE,
                                 *args, **kwds)

# if wx.Platform == '__WXMSW__':
# self.SetExtraStyle(wx.WS_EX_CONTEXTHELP)

If I activate the last two lines the context help shows up on the title bar, but the min/max boxes are no longer shown.

Win7, wxPy 2.9.2.4

Is this as designed?

As an alternative, would it be possible to setup a custom button and using wx.ID_CONTEXT_HELP and have the same default binding to all controls - i.e. it shows the msg set using SetHelpText.

Tried using an AquaButton and setting the wx.ID_CONTEXT_HELP but I guess I have to bind some event to all controls or maybe to the dialog?

Werner

I setup a dialog like this:

self._init_ctrls(parent, style=style|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|
wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE,
*args, **kwds)

# if wx.Platform == '__WXMSW__':
# self.SetExtraStyle(wx.WS_EX_CONTEXTHELP)

If I activate the last two lines the context help shows up on the title
bar, but the min/max boxes are no longer shown.

Win7, wxPy 2.9.2.4

Is this as designed?

It's probably a requirement/limitation of Windows.

As an alternative, would it be possible to setup a custom button and
using wx.ID_CONTEXT_HELP and have the same default binding to all
controls - i.e. it shows the msg set using SetHelpText.

See wx.ContextHelpButton

···

On 9/15/11 7:20 AM, werner wrote:

--
Robin Dunn
Software Craftsman

Sorry wasn't clear, I am aware of this one.

What if I would like it to be based on e.g. wx.lib.Aquabutton?

I see that it is based on BitmapButton, but then it looks like it inits C++ stuff with these swig calls, so I guess I can't used create my own as Aquabutton - guess will just have to try it.

Werner

···

On 09/17/2011 08:45 PM, Robin Dunn wrote:

On 9/15/11 7:20 AM, werner wrote:

I setup a dialog like this:

self._init_ctrls(parent, style=style|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|
wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE,
*args, **kwds)

# if wx.Platform == '__WXMSW__':
# self.SetExtraStyle(wx.WS_EX_CONTEXTHELP)

If I activate the last two lines the context help shows up on the title
bar, but the min/max boxes are no longer shown.

Win7, wxPy 2.9.2.4

Is this as designed?

It's probably a requirement/limitation of Windows.

As an alternative, would it be possible to setup a custom button and
using wx.ID_CONTEXT_HELP and have the same default binding to all
controls - i.e. it shows the msg set using SetHelpText.

See wx.ContextHelpButton

Sorry. Yeah, it's just a wx.BitmapButton that does the equivalent of this in its EVT_BUTTON event handler:

  csHelp = wx.ContextHelp(self.GetParent(), True)

···

On 9/18/11 12:46 AM, werner wrote:

On 09/17/2011 08:45 PM, Robin Dunn wrote:

On 9/15/11 7:20 AM, werner wrote:

I setup a dialog like this:

self._init_ctrls(parent, style=style|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|
wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE,
*args, **kwds)

# if wx.Platform == '__WXMSW__':
# self.SetExtraStyle(wx.WS_EX_CONTEXTHELP)

If I activate the last two lines the context help shows up on the title
bar, but the min/max boxes are no longer shown.

Win7, wxPy 2.9.2.4

Is this as designed?

It's probably a requirement/limitation of Windows.

As an alternative, would it be possible to setup a custom button and
using wx.ID_CONTEXT_HELP and have the same default binding to all
controls - i.e. it shows the msg set using SetHelpText.

See wx.ContextHelpButton

Sorry wasn't clear, I am aware of this one.

What if I would like it to be based on e.g. wx.lib.Aquabutton?

I see that it is based on BitmapButton, but then it looks like it inits
C++ stuff with these swig calls, so I guess I can't used create my own
as Aquabutton - guess will just have to try it.

--
Robin Dunn
Software Craftsman

...

Sorry. Yeah, it's just a wx.BitmapButton that does the equivalent of this in its EVT_BUTTON event handler:

    csHelp = wx.ContextHelp(self.GetParent(), True)

Great, thanks

Werner

···

On 09/18/2011 10:09 AM, Robin Dunn wrote:

Basically I am stuck getting back to the auiFrame instance I am calling
the new class from ...
Basis: AUI demo from wx.Python demo

What I want:
For commodity I want my notebook tab content to be a separate class -

#I call a function to have the user give me a name for the new
calculation (1st tab of notebook) and then call my function to get
# the notebook instance from the mgr
# then I call the new class TabPanelCustomer which resides outside the
AuiFrame class

def OnNewCalculation(self, event):
        dlg = wx.TextEntryDialog(
        self, u'Name for calculation', u'Ndew calc', 'Python')
        dlg.SetValue("calculation-")
        if dlg.ShowModal() == wx.ID_OK:
        calculationname = dlg.GetValue()
        self.OnNewCustomerDataTab(-1,calculationname,thebutton)
           
        dlg.Destroy()

#the 1st tab
def OnNewCustomerDataTab(self, event, calculationname,thebutton):
        auibook = self._mgr.GetPane("notebook_content").window
        newtab = TabPanelCustomer(auibook,calculationname,thebutton,self)
        auibook.AddPage(newtab, u'Kundendaten', select=True)

#the 2nd tab
def OnNewProjectSettingsTab(self, event, calculationname):
        auibook = self._mgr.GetPane("notebook_content").window
        newtab = TabPanelSettings(auibook,calculationname)
        auibook.AddPage(newtab, u'Projektdaten', select=True)

# the new class
class TabPanelCustomer(wx.Panel):
    def __init__(self, parent, bordername, thebutton, auiframe):

        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
        self.bordername = bordername
        self.thebutton = thebutton
        self.auiframe = auiframe
        self.SetBackgroundColour('White')
        # .....
        # ..... sizers, etc ......
        # here the problem:
        save_btn = wx.Button(self, -1, u'Save')
        clear_btn = wx.Button(self, -1, u'Clear')
        save_btn.Bind(wx.EVT_BUTTON,
AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))

My problem is that I cannot bind the save button to the funtion
OnNewProjectSettingsTab()
I get an assertion error. (see below)

General thinking/ design problem? Solutions/ Approaches?

ThanX

···

--

AssertionError:
File "gui2-standaloneV5.py", line 3893, in <module>
  app.MainLoop()
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 8010, in MainLoop
  wx.PyApp.MainLoop(self)
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7306, in MainLoop
  return _core_.PyApp_MainLoop(*args, **kwargs)
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibar.py", line 3641, in OnLeftUp
  self.ProcessEvent(e)
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3863, in ProcessEvent
  return _core_.EvtHandler_ProcessEvent(*args, **kwargs)
File "gui2-standaloneV5.py", line 3235, in OnNewCalculation
  self.OnNewCustomerDataTab(-1,calculationname,thebutton)
File "gui2-standaloneV5.py", line 3243, in OnNewCustomerDataTab
  newtab = TabPanelCustomer(auibook,calculationname,thebutton,self)
File "gui2-standaloneV5.py", line 414, in __init__
  save_btn.Bind(wx.EVT_BUTTON, AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3917, in Bind
  assert callable(handler)

I am still struggling with my problem (see below).

Anybody got any (even just a at 1st glance ) idea what I am missing?

Or ist there somewhere an example that follows AUI demo layout (AuiFrame
w/ notebook, etc..) and demonstrates binding a button in a botebook tab
to a function???

ThanX (... and sorry in case I am too 'resolute' :slight_smile: )

···

Am 18.09.11 13:26, schrieb Tobias Weber:

Basically I am stuck getting back to the auiFrame instance I am calling
the new class from ...
Basis: AUI demo from wx.Python demo

What I want:
For commodity I want my notebook tab content to be a separate class -

#I call a function to have the user give me a name for the new
calculation (1st tab of notebook) and then call my function to get
# the notebook instance from the mgr
# then I call the new class TabPanelCustomer which resides outside the
AuiFrame class

def OnNewCalculation(self, event):
        dlg = wx.TextEntryDialog(
        self, u'Name for calculation', u'Ndew calc', 'Python')
        dlg.SetValue("calculation-")
        if dlg.ShowModal() == wx.ID_OK:
        calculationname = dlg.GetValue()
        self.OnNewCustomerDataTab(-1,calculationname,thebutton)
           
        dlg.Destroy()

#the 1st tab
def OnNewCustomerDataTab(self, event, calculationname,thebutton):
        auibook = self._mgr.GetPane("notebook_content").window
        newtab = TabPanelCustomer(auibook,calculationname,thebutton,self)
        auibook.AddPage(newtab, u'Kundendaten', select=True)

#the 2nd tab
def OnNewProjectSettingsTab(self, event, calculationname):
        auibook = self._mgr.GetPane("notebook_content").window
        newtab = TabPanelSettings(auibook,calculationname)
        auibook.AddPage(newtab, u'Projektdaten', select=True)

# the new class
class TabPanelCustomer(wx.Panel):
    def __init__(self, parent, bordername, thebutton, auiframe):

        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
        self.bordername = bordername
        self.thebutton = thebutton
        self.auiframe = auiframe
        self.SetBackgroundColour('White')
        # .....
        # ..... sizers, etc ......
        # here the problem:
        save_btn = wx.Button(self, -1, u'Save')
        clear_btn = wx.Button(self, -1, u'Clear')
        save_btn.Bind(wx.EVT_BUTTON,
AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))

My problem is that I cannot bind the save button to the funtion
OnNewProjectSettingsTab()
I get an assertion error. (see below)

General thinking/ design problem? Solutions/ Approaches?

ThanX

--
--------------------------------------------------
Tobias Weber
CEO

The ROG Corporation GmbH
Donaustaufer Str. 200
93059 Regensburg
Tel: +49 941 4610 57 55
Fax: +49 941 4610 57 56

www.roglink.com

GeschŠftsfŸhrer: Tobias Weber
Registergericht: Amtsgericht Regensburg - HRB 8954
UStID DE225905250 - Steuer-Nr.184/59359
--------------------------------------------------

Finally I found my mistake.. just posting for mailing list reasons in
case some follow my foolish path :wink:

The solution lies in closely studying:
http://wiki.wxpython.org/self.Bind%20vs.%20self.button.Bind

I never really saw the difference in the 2 ways of binding ...
Added on top I am becoming more and more proficient in understanding
Andrea's AGW AUI :slight_smile:

the wrong line:

save_btn.Bind(wx.EVT_BUTTON,AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))

correct line:

panel.Bind(wx.EVT_BUTTON, self.OnAbout, save_btn)

···

Am 18.09.11 22:40, schrieb Tobias Weber:

I am still struggling with my problem (see below).

Anybody got any (even just a at 1st glance ) idea what I am missing?

Or ist there somewhere an example that follows AUI demo layout (AuiFrame
w/ notebook, etc..) and demonstrates binding a button in a botebook tab
to a function???

ThanX (... and sorry in case I am too 'resolute' :slight_smile: )

Am 18.09.11 13:26, schrieb Tobias Weber:

Basically I am stuck getting back to the auiFrame instance I am calling
the new class from ...
Basis: AUI demo from wx.Python demo

What I want:
For commodity I want my notebook tab content to be a separate class -

#I call a function to have the user give me a name for the new
calculation (1st tab of notebook) and then call my function to get
# the notebook instance from the mgr
# then I call the new class TabPanelCustomer which resides outside the
AuiFrame class

def OnNewCalculation(self, event):
        dlg = wx.TextEntryDialog(
        self, u'Name for calculation', u'Ndew calc', 'Python')
        dlg.SetValue("calculation-")
        if dlg.ShowModal() == wx.ID_OK:
        calculationname = dlg.GetValue()
        self.OnNewCustomerDataTab(-1,calculationname,thebutton)
           
        dlg.Destroy()

#the 1st tab
def OnNewCustomerDataTab(self, event, calculationname,thebutton):
        auibook = self._mgr.GetPane("notebook_content").window
        newtab = TabPanelCustomer(auibook,calculationname,thebutton,self)
        auibook.AddPage(newtab, u'Kundendaten', select=True)

#the 2nd tab
def OnNewProjectSettingsTab(self, event, calculationname):
        auibook = self._mgr.GetPane("notebook_content").window
        newtab = TabPanelSettings(auibook,calculationname)
        auibook.AddPage(newtab, u'Projektdaten', select=True)

# the new class
class TabPanelCustomer(wx.Panel):
    def __init__(self, parent, bordername, thebutton, auiframe):

        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
        self.bordername = bordername
        self.thebutton = thebutton
        self.auiframe = auiframe
        self.SetBackgroundColour('White')
        # .....
        # ..... sizers, etc ......
        # here the problem:
        save_btn = wx.Button(self, -1, u'Save')
        clear_btn = wx.Button(self, -1, u'Clear')
        save_btn.Bind(wx.EVT_BUTTON,
AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))

My problem is that I cannot bind the save button to the funtion
OnNewProjectSettingsTab()
I get an assertion error. (see below)

General thinking/ design problem? Solutions/ Approaches?

ThanX

--
--------------------------------------------------
Tobias Weber
CEO

The ROG Corporation GmbH
Donaustaufer Str. 200
93059 Regensburg
Tel: +49 941 4610 57 55
Fax: +49 941 4610 57 56

www.roglink.com

GeschŠftsfŸhrer: Tobias Weber
Registergericht: Amtsgericht Regensburg - HRB 8954
UStID DE225905250 - Steuer-Nr.184/59359
--------------------------------------------------