Alaska Software Inc. - XbpTabPage:tabActivate
Username: Password:
AuthorTopic: XbpTabPage:tabActivate
Joao GrenhasXbpTabPage:tabActivate
on Mon, 05 Dec 2016 22:03:41 +0000
Hello All,

In XbpTabPage:tabActivate documentation says that:
"If an object of the XbpTabPage class is used (rather than an object of a 
subclass), the code block contained in the :tabActivate  callback slot must 
call the :maximize() method in order to bring the page to the foreground and 
make it visible. "


So i made a test and apparently that is not the case. I defined the 
codeblock as:

oTabPage:tabActivate := { |uNIL1,uNIL2,self| Tone(800) }

When we click on another tabpage, it beeps but it also changes to there...

Why? Am i doing something wrong or Is this a natural behaviour?
And before someone asks, yes, i would like that behaviour... 

Best Regards,


xbpTabpage2.prg
Andreas Gehrs-Pahl
Re: XbpTabPage:tabActivate
on Tue, 06 Dec 2016 04:41:14 -0500
Joao,

>In XbpTabPage:tabActivate documentation says that:
>"If an object of the XbpTabPage class is used (rather than an object of a 
>subclass), the code block contained in the :tabActivate callback slot must 
>call the :maximize() method in order to bring the page to the foreground and 
>make it visible."

The wording isn't very clear, but what this probably means is that you need 
to add Maximize/Minimize code to an :TabActivate CodeBlock that is called 
directly, rather than through setting focus to the Tab Page. If you set 
focus to a Tab Page, for example with a Mouse Click, the Keyboard, or the 
SetAppFocus() function, an xbeTab_TabActivate event is created and after the 
(default) :TabActivate() method is executed, the :TabActivate callback slot 
is evaluated -- if a CodeBlock was assigned to it.

>Why? Am i doing something wrong or Is this a natural behaviour?

The default :TabActivate() method does the Maximize/Minimize, which is 
implemented in the "\Source\Runtime\DUI\XbParts.prg" file. The documentation 
pre-dates the XbpBaseTabPage() class and the default :TabActivate() method 
in that source file, as the documentation also says:

"The callback method in the XbpTabPage class does not execute any code but 
 is provided for user defined subclasses that use a callback method instead 
 of a callback code block."

Which is obviously incorrect, as you can see in the above-mentioned source 
code, which does exactly what one would expect -- maximizing the selected 
tab and minimizing all other tabs.

But, if you want to activate a specific tab page programmatically and 
synchronously without clicking on the tab with the mouse or using the 
SetAppFocus() function -- for example through a keyboard shortcut or with a 
push button -- you will have to run code that does both: execute the default 
:TabActivate() method (or similar code that maximizes the selected tab and 
minimizes all other ones), as well as evaluate the CodeBlock in the 
:TabActivate callback slot. If you only do one, you will either get your 
Tone() or the visual Minimizing and Maximizing, but not both.

I have updated your demo program to demonstrate this and show several ways 
how this can be done and what might not work.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC

XbpTabPage2a.zip