Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-09

Enabling menu-options depending on a Lazarus-setting?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joost van der Sluis

Hi all,

On Linux there's the option to view a window with the console-output of applications being debugged.

This option is enabled with the define DBG_ENABLE_TERMINAL in three units.

In debugger/debugger.pp the define is set for linux only, with the result that the window is actually visible in the menu.

In components/lazdebuggergdbmi/gdbmimiscclasses.pp and components/lazdebuggergdbmi/gdbmimiscclasses.pp the define is also set on linux, so that this debugger actually sends the console output to the screen.

Now I have my own debugger, and this debugger also supports the console-window on OS/X. So I could adapt the define in debugger.pp for OS/X, but then the menu-item also appears when a gdb-based debugger is used, which do not support this option on OS/X.

So, question: what would be the correct way to display this menu-option, based onto the selected debugger. (Add a property to TDebuggerIntf, but after that?)

regards,

Joost.

Reply by email

Martin Frb
to Joost van der Sluis
Joost van der Sluis wrote 25 lines
Hi all, On Linux there's the option to view a window with the console-output of applications being debugged. This option is enabled with the define DBG_ENABLE_TERMINAL in three units. In debugger/debugger.pp the define is set for linux only, with the result that the window is actually visible in the menu. In components/lazdebuggergdbmi/gdbmimiscclasses.pp and components/lazdebuggergdbmi/gdbmimiscclasses.pp the define is also set on linux, so that this debugger actually sends the console output to the screen. Now I have my own debugger, and this debugger also supports the console-window on OS/X. So I could adapt the define in debugger.pp for OS/X, but then the menu-item also appears when a gdb-based debugger is used, which do not support this option on OS/X. So, question: what would be the correct way to display this menu-option, based onto the selected debugger. (Add a property to TDebuggerIntf, but after that?)

Add a class[1] method to the debugger-class. return true/false, depending on the availability of the feature.

The base class, would have the current ifdef. All other code depends on the value of the method.

In ide/DebugManager the debugger class is selected and setup. That would be the place to update the menu (maybe enable/disable instead of hiding).

[1] If it is a class method debug manager may be able to decide on the class. If the code in debug manager allows to wait for the instance, then it can be a normal method.

Reply by email

Joost van der Sluis
to Martin Frb
Martin Frb wrote 10 lines
On 02/09/2014 12:11, Joost van der Sluis wrote: Add a class[1] method to the debugger-class. return true/false, depending on the availability of the feature. The base class, would have the current ifdef. All other code depends on the value of the method. In ide/DebugManager the debugger class is selected and setup. That would be the place to update the menu (maybe enable/disable instead of hiding).

How do I enable/disable a menu-item in the IDE?

Joost.

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 13 lines
On 09/02/2014 03:31 PM, Martin Frb wrote: > On 02/09/2014 12:11, Joost van der Sluis wrote: > Add a class[1] method to the debugger-class. return true/false, > depending on the availability of the feature. > > The base class, would have the current ifdef. All other code depends on > the value of the method. > > > In ide/DebugManager the debugger class is selected and setup. That would > be the place to update the menu (maybe enable/disable instead of hiding). How do I enable/disable a menu-item in the IDE?
Find the TIDEMenuItem and use item.Enabled:=true/false.

Mattias

Reply by email

Martin Frb
to Joost van der Sluis: How do I enable/disable a menu-item in the IDE? Joost.
Example in
procedure TDebugManager.ConnectMainBarEvents;

in ide/debugmanager

Joost van der Sluis wrote 23 lines
On 09/02/2014 03:31 PM, Martin Frb wrote: > On 02/09/2014 12:11, Joost van der Sluis wrote: > Add a class[1] method to the debugger-class. return true/false, > depending on the availability of the feature. > > The base class, would have the current ifdef. All other code depends on > the value of the method. > > > In ide/DebugManager the debugger class is selected and setup. That would > be the place to update the menu (maybe enable/disable instead of > hiding). How do I enable/disable a menu-item in the IDE? Joost. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Joost van der Sluis
to Martin Frb
Martin Frb wrote
Example in procedure TDebugManager.ConnectMainBarEvents;

This was at least a little bit of use. Frustrating that disabling a menu-item in the IDE takes more time than implementing the whole pseudo-terminal feature.

It still does not work, though. TDebugManager.SetDebugger is useless because it is only called when the debugger is started. So I had to set it somewhere else.

The problem that I have now is that when I add the BaseDebugManager to the implementation uses-section of the debugger unit, *all* ide-settings are lost as soon as I open the options-screen. Seems like some magic is happening here. Does anyone have a clue what?

Regards,

Joost.

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 16 lines
On 09/04/2014 11:42 PM, Martin Frb wrote: > Example in > procedure TDebugManager.ConnectMainBarEvents; This was at least a little bit of use. Frustrating that disabling a menu-item in the IDE takes more time than implementing the whole pseudo-terminal feature. It still does not work, though. TDebugManager.SetDebugger is useless because it is only called when the debugger is started. So I had to set it somewhere else. The problem that I have now is that when I add the BaseDebugManager to the implementation uses-section of the debugger unit, *all* ide-settings are lost as soon as I open the options-screen. Seems like some magic is happening here. Does anyone have a clue what?

I'm not sure, what you want to do.
What options are you working on?
What menu item do you want to enable/disable?

Mattias

Reply by email