Page 2 of 2
Posted: Sun Apr 20, 2008 2:38 pm
by Sparkie
To be honest, I too didn't realize the tc\lParam held the handle to the Static control for each panel. I'd say it's safer to leave it alone as PureBasic itself may be utilizing the info for some internal doings.
Posted: Sun Apr 20, 2008 2:41 pm
by srod
In your case
Code: Select all
GetParent_(GadgetID(FileList()\Editor))
would also return the handle of the panel item etc. The handle of the static panel item is placed in the lParam field by Purebasic, not by Windows, as indeed the static window is added by Purebasic. Window's tab controls do not add these static containers by default, you have to do that yourself.
I have used the lParam method in various applications and it works fine, I've encountered no problems.
Posted: Sun Apr 20, 2008 3:47 pm
by Sparkie
srod wrote:The handle of the static panel item is placed in the lParam field by Purebasic, not by Windows, as indeed the static window is added by Purebasic.
That's why I thought it might be safer to leave it alone, but if you are not having any issues with it (and if it's future-proof), then all the better.

Posted: Sun Apr 20, 2008 3:55 pm
by srod
Aye, PB's panel gadget handles all of the static containers for us and it will always need to store the resulting handles somewhere - lParam is intended by MS for exactly that reason.
Some implementations of 'panel gadgets' based on Win tab-controls which I've seen in other languages do not use these static containers. Instead a list of controls is created for each tab and when the user selects a particular tab, these controls are simply repositioned etc. In this case lParam is typically used to point to the list etc.
So, in PB's case, I really cannot see a circumstance in which Freak would decide not to store the static hWnd in lParam etc.

Posted: Sun Apr 20, 2008 4:04 pm
by Sparkie
Maybe I've misunderstood you srod. Are you saying it is or is not safe to change the value of the lParam ?
Posted: Sun Apr 20, 2008 4:10 pm
by srod
DO NOT change the lParm value!!!

Use it by all means. What I am saying is that I think it is safe to assume that lParam (in PB's case) will always hold the handle of the appropriate static container etc. that Freak will not change that anytime soon.
The only time I have changed the lParam value in the case of a panel gadget is when dynamically switching static containers around, but that involved more than just switching corresponding lParam values etc.
Posted: Sun Apr 20, 2008 4:19 pm
by Sparkie
Ok, NOW I hear what you're saying and we DO agree.
And you think
you're getting old?

Posted: Sun Apr 20, 2008 4:29 pm
by srod
Posted: Mon Apr 21, 2008 6:50 pm
by hagibaba
The handle of the static panel item is placed in the lParam field by Purebasic, not by Windows
This is what I was wondering. In that case I will continue to use GetPanelID, nice to know of the GetParent_() method. Thanks srod.