PanelGadget Question

Just starting out? Need help? Post your questions and find answers here.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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.
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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. :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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. :)
I may look like a mule, but I'm not a complete ass.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Maybe I've misunderstood you srod. Are you saying it is or is not safe to change the value of the lParam ?
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Ok, NOW I hear what you're saying and we DO agree. :)

And you think you're getting old? :lol:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

:lol:
I may look like a mule, but I'm not a complete ass.
hagibaba
Enthusiast
Enthusiast
Posts: 170
Joined: Fri Mar 05, 2004 2:55 am
Location: UK
Contact:

Post 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.
Post Reply