[Lazarus] Detect that component selected in OI.

Ondrej Pokorny lazarus at kluug.net
Sun May 22 08:50:19 CEST 2016

I didn't know it either. But it was quite easy to find out:

1.) Debug Lazarus IDE within another instance.
2.) In the IDE-to-debug create a project with TPageControl and 2 tabs.
3.) Set breakpoint to "TCustomTabControl.ShowCurrentPage" in the 
debugger IDE.
4.) Change pages with the OI in the IDE-to-debug.

Now you get your Call Stack filled with useful information. See #4 for 
relevant line:

#0 SHOWCURRENTPAGE(0x15087170) at include\customnotebook.inc:1049
#1 DOSENDPAGEINDEX(0x15087170) at include\customnotebook.inc:1072
#2 INTERNALSETPAGEINDEX(0x15087170, 0) at include\customnotebook.inc:985
#3 SETPAGEINDEX(0x15087170, 0) at include\customnotebook.inc:587
*#4 DOSELECTIONCHANGED(0x150683a0) at componenttreeview.pas:315*
#5 INTERNALSELECTIONCHANGED(0x150683a0) at include\treeview.inc:5715
#6 UNLOCKSELECTIONCHANGEEVENT(0x150683a0) at include\treeview.inc:5909
#7 SELECTONLYTHIS(0x169b89f0, 0x19c80ed8) at include\treeview.inc:2097
#8 MOUSEDOWN(0x150683a0, MBLEFT, [SSLEFT], 104, 64) at 

So you can see that the changing code is hard-coded into IdeIntf. (The 
callback is in "TComponentTreeView.DoSelectionChanged;".)

IMO you can suggest a custom designing message that will handle it 
without hard-coding it into the IDE. Because e.g. the TNotebook page 
change doesn't work.


On 21.05.2016 22:49, Vojtěch Čihák wrote:
> That's something else. I need something that will be part of 
> component. Something like overriden SetFocus; or so.
> So far I tried CMDesignHitTest and DoEnter but it didn't work.
> It's like when you design Form with PageControl and two TabSheets. You 
> select the second TabSheet in OI and PageControl "knows" it and it 
> changes the tabs on the form. I'd like to know how this works (what 
> component's code allows this).
> Thanks, V.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160522/d8525df7/attachment-0003.html>

More information about the Lazarus mailing list