|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sat Apr 04, 2020 3:12 pm Post subject: Child window handles |
|
|
I ran across this while building a set of child windows for %ps. I had intended to use the handle for the %sh that builds the "tab" to enable or disable the tab using its handle. But, the handles don't seem to be valid.
Specifically, the handles returned when building the %sh is -1, as well as after the %ps has been built and the tabs active.
The code that shows this is:
Code: | winapp
program cmain
use mswin
integer:: i,j=2,k=10,l=30
integer,external:: button1
integer:: ps(3)
common/sheet_test/ps
i = winio@('%sh&',ps(1))
i = winio@('%ca[First]%rd',j)
i = winio@('%sh&',ps(2))
i = winio@('%ca[Second]%rd',k)
i = winio@('%sh&',ps(3))
i = winio@('%ca[Third]%rd',l)
print *,ps
i = winio@('%3ps&',ps(1),ps(2),ps(3))
i = winio@('%^bt[print_handles]',button1)
end
INTEGER(KIND=7) FUNCTION BUTTON1()
integer:: ps(3)
common/sheet_test/ps
BUTTON1= -1
print *,'Button_press=',ps
RETURN
END
|
This prints the handles assigned to the array element (named ps) before the parent window is created, and after the button press. I would have expected that at least the button press would show window handles. Alas, still -1.
My (perhaps faulty) remembrance is that after the %sh has closed the building of the child window, the control associated with the %sh then contains a handle. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Sat Apr 04, 2020 4:03 pm Post subject: |
|
|
The "handles" referred to in the documentation for %ps are not Windows HWND handles. They are variables whose addresses connect the %ps to its sheets.
You can get the Windows HWND of a sheet via %hw as in
Code: | i = winio@('%sh&',ps(1))
i = winio@('%hw&',h(1))
i = winio@('%ca[First]%rd',j)
|
where h is INTEGER(7) h(3). |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sat Apr 04, 2020 6:16 pm Post subject: |
|
|
Paul, this makes sense.
I had mused to myself before submitting the post that it must be the address of the control that is being used for %sh since everything seemed to work just fine.
It does leave one with a more complex solution to the EnableWindows way of displaying or hiding content.
Bill |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|