|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Fri Sep 10, 2021 8:38 am Post subject: Possible to detect %gr losing focus? |
|
|
Here's a simple program that tracks a cursor in a %gr drawing surface:
Code: | WINAPP
OPTIONS (INTL, DREAL)
PROGRAM FOLLOW_THE_MOUSE
C ------------------------
COMMON /MOUSE/ IX, IY, LW, JX, JY
INCLUDE <WINDOWS.INS>
EXTERNAL KB_GET_CURSOR_POS
DIMENSION IAR(3)
IAR = 25 ! whole array
JX = 0
JY = 0
IW = WINIO@ ('%ca[Follow the cursor]&')
IW = WINIO@ ('%3sb%lc&', IAR, LW)
IW = WINIO@ ('%`cu&', CURSOR_ARROW)
IW = WINIO@ ('%^gr[blue,full_mouse_input]', 600, 400,
& KB_GET_CURSOR_POS)
END
INTEGER FUNCTION KB_GET_CURSOR_POS()
C ------------------------------------
COMMON /MOUSE/ IX, IY, LW, JX, JY
CHARACTER*(20) XTEXT, YTEXT
INCLUDE <WINDOWS.INS>
IX = CLEARWIN_INFO@ ('GRAPHICS_MOUSE_X')
IY = CLEARWIN_INFO@ ('GRAPHICS_MOUSE_Y')
WRITE(XTEXT,'(" X=",I4)') IX
WRITE(YTEXT,'(" Y=",I4)') IY
CALL DRAW_LINE_BETWEEN@ (JX, JY, IX, IY, RGB@(255,255,255))
JX = IX
JY = IY
CALL SET_STATUS_TEXT@ (LW, 0, XTEXT)
CALL SET_STATUS_TEXT@ (LW, 1, YTEXT)
KB_GET_CURSOR_POS = 2
END |
Interestingly, the line becomes broken if I use USE_GDIPLUS@, so clearly it needs to be more than 1 pixel wide for the smoothing not to break up the line.
My question is: How do I detect the drawing surface losing focus? I could then blank the coordinates in the status bar (and also at the expense of a little programming, deal with re-entry properly, but after all, this is just a demonstrator).
Working with %sb, and comparing my efforts to MS apps, it does seem to me that it would be handy to have a slider %sl control in the status bar, wouldn't it? (for Zooming, principally).
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sat Sep 11, 2021 7:48 am Post subject: |
|
|
Eddie
ADD_CURSOR_MONITOR@ can be used to detect the HWND of the control under the cursor. ADD_FOCUS_MONITOR@ tracks which control has the focus.
%1.3ob[status] could be used to add a slider to the status bar. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Sat Sep 11, 2021 9:57 am Post subject: |
|
|
Hi Paul,
Many thanks for the advice about the cursor and focus.
I realised that the %ob[status] could do it, but it was in the context of your new %sb that I was enquiring. You had a %br in there, and actually, %br is better in a dialog than tucked away because it basically says "Go away, I'm busy", a message that has to be received to be understood, whereas a slider is where users get used to looking for it, being used to MS Office.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sat Sep 11, 2021 11:41 am Post subject: |
|
|
Eddie
I suggest trying %br preceeded by %ap. But the Z-order may not be what you need to make the bar visible. Try adding this at the end of the sequence. Otherwise you may need to call the Microsoaft API function BringWindowToTop for the bar.
Let me know how you get on. I might be able to add something useful to ClearWin+. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Sat Sep 11, 2021 6:39 pm Post subject: |
|
|
Hi Paul,
Thanks for the advice. I'm currently having another go at %lv, and struggling. I'll have a look at the status bar again later.
I had a go with %bn, but couldn't see anything until I set 1 24 default.manifest in resources. The online help has %bt instead of %bn in the second example line.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sun Sep 12, 2021 9:04 am Post subject: |
|
|
Eddie
Thanks. I have corrected the typo. For me it works without the manifest but there is something wrong. The caption only appears when I use [text=...]. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Sun Sep 12, 2021 10:43 am Post subject: |
|
|
Paul,
... and the arrow is blue!
I think that there may also be something wrong with 'notes'. I tried:
Code: | IW = WINIO@('%16bn[Zoom,notes=Choose block select]') |
and then I get an error that 'lock' isn't a valid option!
Eddie
(Using files like SALFLIBC.DLL from the forum) |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sun Sep 12, 2021 3:48 pm Post subject: |
|
|
Try putting the string for notes= in quotation marks. Double quotes within single quotes should work. |
|
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
|