View previous topic :: View next topic |
Author |
Message |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Tue Jun 14, 2016 12:39 pm Post subject: Handles? |
|
|
ALL handles have to be 8 byte long ?
What about openr@, readr@, closer@, doserr@, ... ?
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Jun 14, 2016 1:41 pm Post subject: |
|
|
Only Windows handles are 64 bit integers for 64 bit applications.
The ones listed are still as they were (mostly 16 bit integers). |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Wed Aug 24, 2016 3:01 pm Post subject: |
|
|
It would make life easier, if " INTEGER(KIND=CW_HANDLE) :: Name " would be accetped as well from FTN95 32-bit version. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Aug 24, 2016 4:16 pm Post subject: |
|
|
CW_HANDLE is an integer parameter with the value 7.
It is declared in an INCLUDE file such as clearwin.ins or in an equivalent module. It should work OK in 32 bit mode if these are up-to-date. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Wed Aug 24, 2016 5:20 pm Post subject: |
|
|
FTN95/Win32 Ver. 8.00.0
MODULE MsgWin
IMPLICIT NONE
INTEGER(KIND=CW_HANDLE) :: MessageWindow
END MODULE MsgWin
error 172 - Constant expression expected |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Aug 24, 2016 7:49 pm Post subject: |
|
|
The compiler does not understand CW_HANDLE.
It must be defined either directly or via an INCLUDE statement or a USE statement. For example...
INCLUDE <clearwin.ins>
or an equivalent USE statement. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Mon Aug 29, 2016 9:22 am Post subject: |
|
|
Paul,
if FTN95 would know CW_HANDLE it would make life easier. In non of my MODULEs I have any INCLUDE or USE file.
iFort allows INTEGER(HANDLE) :: ...
I have a lot of problems to decide which variables are handles in your sense and should be int*8. I have handles for windows, buttons, property pages (%ps), fonts, pipes, graphic areas, ...
Many CLearWin formats have a "ctrl". I found as well "ctrl is a handle ..." ???
Could you provide a list for int*8 handles?
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Aug 29, 2016 9:55 am Post subject: |
|
|
Erwin
Perhaps it would be simpler for you to use the value 7 directly in your code.
INTEGER(7) is required for "Windows" handles provided by the Microsoft Windows API. These are effectively identifiers for Windows controls and dialog boxes. Examples are %hw, %lc and routines such as GET_WINDOW_LOCATION@.
INTEGER(3) is used for "handles" that are internal to ClearWin+. For example %lw, %sh, %gr and routines such as SELECT_GRAPHICS_OBJECT@.
The plan is to change the documentation and to use something other than "handle" for ClearWin+ handles. In the mean time, if in doubt, please ask. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Mon Aug 29, 2016 6:14 pm Post subject: |
|
|
Paul,
unfortunately it's not enough to say "Examples are ...".
I would like to know precisely where I have to use integer*8.
Therefore I extracted all (67) format codes in use from my source code (~90.000 lines) and sorted. For most of them there is no question. Attached a list with open points. Please complete it.
Code: | %bm draw a bitmap >>> handle
%bt insert standard button >>> ctrl
%cw insert ClearWin window >>> handle
%fh use a Windows API font >>> handle
%ga gang radio buttons >>> ???
%gr drawing surface >>> handle int(3)
%hw handle of current window >>> handle int(7)
%ib image button >>> ctrl
%lc handle of previous control >>> handle int(7)
%lw return and leave window open >>> ctrl int(3)
%mi caption icon >>> handle
%ps property sheet >>> sheet ID
%rb radio button >>> ctrl
%sh create property sheet >>> sheet ID int(3)
%th tooltip help >>> ctrl
%og OpenGL graphics region (only win32 ???)
|
The same questions will arise with the ClearWin functions in use. I hope you can give a list of all functions dealing with integer*8 values!
Furthermore I would like to see a.s.a.p. updated document files where you use e.g. the word "handle" only for int*8 handles and otherwise "ctrl".
As we see above in %gr and %hw it's not yet consistent.
I would like to remind you as well to my suggestion to remove all gFortran hints from the standard documentation.
(Up to now I did not yet get any of my 31 programs containing ClearWin elements running under Fortran 64.)
Erwin |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Tue Aug 30, 2016 12:39 am Post subject: |
|
|
Defining all potential "handles" as INTEGER*8 is probably the safest approach, as you then provide 8 bytes to store the information being used. As the windows handles are typically only transferred between routines, and not used locally, this does not cause a problem.
For clearwin+ controls, that are integer*2 or integer*4, providing an integer*8 defined value also works.
The only error occurs if returning an integer*8 value to an integer*2 or integer*4 variable.
I use this approach successfully for %`^gr, %hw and create_graphics_region@, while they may not all be I(7) windows handles. This approach should be robust. If you are not sure, you could initialise the handles first.
John |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Aug 30, 2016 8:38 am Post subject: |
|
|
Here is my list of format codes that use an integer(7) handle...
Format codes that output a Microsoft integer(7) handle...
%hw handle of current window
%lc handle of previous control
%`cw insert ClearWin window
Format code that require a Microsoft integer(7) handle as input...
%fh use a Windows API font
%`bm draw a bitmap
%dw owner draw graphics
%`mi caption icon
%nw new window
This list is intended to be exhaustive so if I have left anything out then please let me know.
Library routines that return an integer(7) handle always do so via the function name. The Silverfrost standard INCLUDE files clearwin.ins and win32api.ins use integer(7) function return values where appropriate, so these INCLUDE files can be used to determine how the return value should be stored. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Tue Aug 30, 2016 9:45 am Post subject: |
|
|
Paul,
clearwin.ins does with
Code: | C_EXTERNAL GET_WINDOW_LOCATION@ '__get_window_location' (VAL,REF, REF,REF,REF)
|
give not any hint that the first VAL should be integer*8
Your hint is insufficient
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Aug 30, 2016 10:58 am Post subject: |
|
|
Erwin
The first argument for GET_WINDOW_LOCATION@ is an input value.
Typically it would be a value returned via %hw or %lc.
You only need to know the type for returned values so you will know how to store them in your program. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Tue Aug 30, 2016 11:39 am Post subject: |
|
|
Paul,
here we have call by value. Is this the case for all ClearWin functions?
What about ClearWin subroutines? Don't the apply integer*8 values at all?
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Aug 30, 2016 12:10 pm Post subject: |
|
|
Erwin
I am not sure that I understand your question.
ClearWin+ routines use a mix of VAL and REF arguments but this does not mean much in this context.
A VAL must be used for input but a REF can be used for input or output or both input and output.
Internally within FTN95, all arguments are REF but VAL is available when calling external routines. |
|
Back to top |
|
|
|