Silverfrost Forums

Welcome to our forums

call back with mouse click

13 Apr 2021 4:25 #27518

Hello, with %ac[Enter] i can force a call back to „integer4 function ienter()“ %ac[UP] i can force a call back to „integer4 function iup()“ a.s.o. (see following code)

module mouse_click
character*20 cdata1,cdata2,cdata3
integer*4 ifocus,ncontrol,icontrol(3)
common/focus_control/ifocus,icontrol,cdata1,cdata2,cdata3
end module mouse_click

winapp 
program mouse_click_test 
use mouse_click
include <windows.ins> 
external ienter,iup,idown,iesc,ifw
cdata1 = '11.11'
cdata2 = '22.22'
cdata3 = '33.33'
!i=ifw()
call add_focus_monitor@(ifw)
ncontrol = 3 
i=winio@('%ac[Enter]&',ienter) 
i=winio@('%ac[UP]&',iup)
i=winio@('%ac[DOWN]&',idown)  
i=winio@('%ac[ESC]&',iesc)
i=winio@('%tc[black]%co[right_justify]&')
i=winio@('%co[data_border]&')	
!i=winio@('%nl%rs%lc&',cdata1(1:10),icontrol(1))
i=winio@('%nl%rs%lc&',cdata1(1:10),icontrol(1))
i=winio@('%nl%rs%lc&',cdata2(1:10),icontrol(2))
i=winio@('%nl%rs%lc' ,cdata3(1:10),icontrol(3))
call remove_focus_monitor@(ifw)       
end 

integer*4 function ienter()
use mouse_click
include <windows.ins>
ienter=1
if(ifocus.eq.icontrol(1))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(3))
if(ifocus.eq.icontrol(3))call set_highlighted@(icontrol(1))
end
integer*4 function iup()
use mouse_click
include <windows.ins>
iup=1
if(ifocus.eq.icontrol(3))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(1))
end
integer*4 function idown()
use mouse_click
include <windows.ins>
idown=1
if(ifocus.eq.icontrol(1))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(3))
end
integer*4 function iesc()
use mouse_click
include <windows.ins> 
iesc=0
end
integer*4 function ifw() 
use mouse_click
include <windows.ins> 
ifw=2 
ifocus=clearwin_info@('FOCUSSED_WINDOW') 
end 

Is there a possibility to force a call back with a left or right mouse click analogous to %ac[Enter]? I tried it with a call back to cmouse as shown in following code, but this didn't work

module mouse_click
character*20 cdata1,cdata2,cdata3
CHARACTER*256 reason
integer*4 ifocus,ncontrol,icontrol(3)
common/focus_control/ifocus,icontrol,cdata1,cdata2,cdata3,reason
end module mouse_click

winapp 
program mouse_click_test 
use mouse_click
include <windows.ins> 
external ienter,iup,idown,iesc,ifw,cmouse
cdata1 = '11.11'
cdata2 = '22.22'
cdata3 = '33.33'
call add_focus_monitor@(ifw)
ncontrol = 3 
i=winio@('%ac[Enter]&',ienter) 
i=winio@('%ac[UP]&',iup)
i=winio@('%ac[DOWN]&',idown)  
i=winio@('%ac[ESC]&',iesc)
i=winio@('%tc[black]%co[right_justify]&')
i=winio@('%co[data_border]&')	
i=winio@('%nl%^rs%lc&',cdata1(1:10),cmouse,icontrol(1))
i=winio@('%nl%rs%lc&',cdata2(1:10),icontrol(2))
i=winio@('%nl%rs%lc' ,cdata3(1:10),icontrol(3))
call remove_focus_monitor@(ifw)       
end 

integer*4 function ienter()
use mouse_click
include <windows.ins>
ienter=1
if(ifocus.eq.icontrol(1))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(3))
if(ifocus.eq.icontrol(3))call set_highlighted@(icontrol(1))
end
integer*4 function iup()
use mouse_click
include <windows.ins>
iup=1
if(ifocus.eq.icontrol(3))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(1))
end
integer*4 function idown()
use mouse_click
include <windows.ins>
idown=1
if(ifocus.eq.icontrol(1))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(3))
end
integer*4 function iesc()
use mouse_click
include <windows.ins> 
iesc=0
end
integer*4 function ifw() 
use mouse_click
include <windows.ins> 
ifw=2 
ifocus=clearwin_info@('FOCUSSED_WINDOW') 
end 
integer*4 function cmouse() 
use mouse_click
include <windows.ins> 
cmouse=1
write(*,*)'Einsprung in function cmouse'
REASON=clearwin_string@('CALLBACK_REASON')
write(*,*)'Einsprung bei linker Maustaste,reason =', reason
end
14 Apr 2021 5:33 #27522

Code did not fit into way too limited space of each post. Try to cut it and post continuation in the following post post

14 Apr 2021 8:03 #27526

sorry, here is the second code again

module mouse_click
character*20 cdata1,cdata2,cdata3
CHARACTER*256 reason
integer*4 ifocus,ncontrol,icontrol(3)
common/focus_control/ifocus,icontrol,cdata1,cdata2,cdata3,reason
end module mouse_click

winapp 
program mouse_click_test 
use mouse_click
include <windows.ins> 
external ienter,iup,idown,iesc,ifw,cmouse
cdata1 = '11.11'
cdata2 = '22.22'
cdata3 = '33.33'
call add_focus_monitor@(ifw)
ncontrol = 3 
i=winio@('%ac[Enter]&',ienter) 
i=winio@('%ac[UP]&',iup)
i=winio@('%ac[DOWN]&',idown)  
i=winio@('%ac[ESC]&',iesc)
i=winio@('%tc[black]%co[right_justify]&')
i=winio@('%co[data_border]&')	
i=winio@('%nl%^rs%lc&',cdata1(1:10),cmouse,icontrol(1))
i=winio@('%nl%rs%lc&',cdata2(1:10),icontrol(2))
i=winio@('%nl%rs%lc' ,cdata3(1:10),icontrol(3))
call remove_focus_monitor@(ifw)       
end 

integer*4 function ienter()
use mouse_click
include <windows.ins>
ienter=1
if(ifocus.eq.icontrol(1))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(3))
if(ifocus.eq.icontrol(3))call set_highlighted@(icontrol(1))
end
integer*4 function iup()
use mouse_click
include <windows.ins>
iup=1
if(ifocus.eq.icontrol(3))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(1))
end
integer*4 function idown()
use mouse_click
include <windows.ins>
idown=1
if(ifocus.eq.icontrol(1))call set_highlighted@(icontrol(2))
if(ifocus.eq.icontrol(2))call set_highlighted@(icontrol(3))
end
integer*4 function iesc()
use mouse_click
include <windows.ins> 
iesc=0
end
integer*4 function ifw() 
use mouse_click
include <windows.ins> 
ifw=2 
ifocus=clearwin_info@('FOCUSSED_WINDOW') 
end 
integer*4 function cmouse() 
use mouse_click
include <windows.ins> 
cmouse=1
write(*,*)'Einsprung in function cmouse'
REASON=clearwin_string@('CALLBACK_REASON')
write(*,*)'Einsprung bei linker Maustaste,reason =', reason
end
15 Apr 2021 1:16 #27538

You can use...

i=winio@('%mg&', WM_LBUTTONDOWN, cmouse)

but this only works when clicking on the 'client' area, not when you click inside one of the integer edit boxes.

cmouse should return the value 2.

To get it to work within an edit box would probably be much more difficult.

16 Apr 2021 7:37 #27546

That's a shame, maybe I'll try it with %eb when I have time. Thank you very much for the quick help.

16 Apr 2021 9:36 #27549

Bartl

Your edit boxes are in fact %rs edit boxes and not %rd edit boxes as I implied above.

I was not suggesting that you try %eb edit boxes.

%rs uses a Microsoft edit control and in theory you can interact with it directly but it would take me some time to work out how to do it from a ClearWin+ program.

The standard way to move from one control to another is to use the TAB key or Ctrl+TAB (if I remember correctly) for going backwards.

16 Apr 2021 5:50 #27558

Paul, Thank you for the information. I thought you meant the% eb function. I'm going to consider using the% rd function instead of% rs. My current solution with the% rs function actually works very well. I just wanted to find a way to achieve the same effect with the mouse button as with the ENTER, UP or DOWN button. But it is not a problem if there is no corresponding possibility. Thanks again.

Please login to reply.