hWndControl parameter parsing

Started by Robert Rioja, February 03, 2016, 09:33:42 PM

Previous topic - Next topic

Robert Rioja

I want to create a function that modifies a control such as a textbox.  I want to pass to it the hWndControl parameter to identify the control, like with other FF functions.  But this function will call PB functions that require the control's IDC number.  How can the function determine the hWndForm for the form and the IDC for the control from the hWndControl parameter?

Paul Squires

In general, you should be able to get the hWndForm for the control by using the api GetParent. Most times, the parent of a control is the form that it is on.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633510(v=vs.85).aspx

To get the IDC of the control from the hWndControl you can use the api GetDlgCtrlId
https://msdn.microsoft.com/en-us/library/windows/desktop/ms645478(v=vs.85).aspx
Paul Squires
PlanetSquires Software

Paul Squires

Also, I would be careful using PB functions that manipulate controls when using FireFly. I have read posts on PB forum that sometimes the PB functions expect the controls to have been created using DDT. Obviously FireFly uses WinAPI rather than DDT.
Paul Squires
PlanetSquires Software

Paul Squires

There is nothing that the PB statements can do that you can not do with just plain WinAPI functions.
Paul Squires
PlanetSquires Software

Robert Rioja

Paul,
Thank you for all of your replies!!!

For years I have used the TreeView control with a combination of FF and PB statements without any problems.  The problem is that there are many PB statements for Treeviews that FF does not have.

Now I wrote some routines and I am trying to simplify their interface.

I will try your suggestions.  Thanks again.

Robert

José Roca

> The problem is that there are many PB statements for Treeviews that FF does not have.

Which ones? In the file TreeViewCtrl.inc of my include files you have all of them and many more.

Paul Squires

Quote from: Jose Roca on February 05, 2016, 01:10:14 AM
> The problem is that there are many PB statements for Treeviews that FF does not have.

...In the file TreeViewCtrl.inc of my include files you have all of them and many more.


Exactly! Jose has hundreds of very useful functions for all types of controls and general Windows things. His code is an invaluable resource for anyone programming in PB.
Paul Squires
PlanetSquires Software

Robert Rioja

Thank you for the tip.  I looked through the documentation and could not find a wrapper equivalent to the PB "Treeview Set User" and "Treeview Get User" functions.  What would be even better would be a way of having a user defined string, not just a number.

José Roca

The member lParam of the TVITEM structure used by TreeView_SetItem and TreeView_GetItem can be used for that purpose.

Robert Rioja