Silverfrost Forums

Welcome to our forums

%ls and %lc don't work together

1 Apr 2014 1:56 #13913

Hello, vertical input works ok. But when I triy to move up with the Cursor up botton, line 1 creates an error. Is it possible, that %ls and %lc don't work together?

Johann

module eingaben_modul
integer*4 sel1,icol
character cbez1(3),cinput1*10,cinput2*10
integer*4 ifocus1, ncontrol1, icontrol1(10)
common/ceing/sel1,sel2,cbez1,cbez2,ifocus1, ncontrol1, icontrol1
end module eingaben_modul 

winapp 0,0
program eingabe
      
use eingaben_modul 
include<windows.ins>

data cbez1   /'A','B','C'/
external ienter_monitor1,iup_monitor1
sel1 = 1
cinput1 = ' '
cinput2 = ' '
icol = rgb@(225,225,225)      
  
i=ifw1() 
call add_focus_monitor@(ifw1) 
ncontrol1 = 3

i=winio@('%ww%bg[grey]%fn[ARIAL]&')
i=winio@('%ac[Enter]&' ,ienter_monitor1 )
i=winio@('%ac[Up]   &' ,iup_monitor1    )
i=winio@('%ac[Esc]  &','EXIT'           )  		
i=winio@('%co[no_data_border]&')

i=winio@('%co[left_justify]%tc[blue]%nl&')
i=winio@('%2nlInput 1:%2ta%~3.4`ls%lc&',cbez1,4L,sel1,1,icontrol1(1))  
     
i=winio@('%nl%co[right_justify]%nlInput 2&')	
i=winio@('%`bg&', icol)
i=winio@('%ta%rs%lc&',cinput1(1:10),icontrol1(2))

i=winio@('%nl%co[right_justify]%nlInput 3&')	
i=winio@('%`bg&', icol)
i=winio@('%ta%rs%lc',cinput2(1:10),icontrol1(3))

call remove_focus_monitor@(ifw1)
     
stop
end


!-------------------------------------
!  function ienter_monitor1()
!-------------------------------------
integer*4 function ienter_monitor1()
use eingaben_modul  
include <windows.ins>
      
ienter_monitor1=1
if(ifocus1 .eq. icontrol1(ncontrol1))call set_highlighted@(icontrol1(ncontrol1))
if(ifocus1 .ne. icontrol1(ncontrol1))then
do k=1,ncontrol1 
if(ifocus1 .eq. icontrol1(k))call set_highlighted@(icontrol1(k+1))
enddo 
endif 
continue 
end

!-------------------------------------
!  function iup_monitor1()
!-------------------------------------
integer*4 function iup_monitor1()
use eingaben_modul
include <windows.ins>

iup_monitor1=1
if(ifocus1 .eq. icontrol1(ncontrol1)) call set_highlighted@(icontrol1(ncontrol1-1))
if(ifocus1 .ne. icontrol1(ncontrol1))then
do l=2,ncontrol1-1
if(ifocus1 .eq. icontrol1(l))call set_highlighted@(icontrol1(l-1))
enddo 
endif
end

!-------------------------------------
!  function ifw1()
!-------------------------------------
integer*4 function ifw1() 
use eingaben_modul
include <windows.ins>
ifw1=1 
ifocus1=clearwin_info@('FOCUSSED_WINDOW') 
end 
1 Apr 2014 3:29 #13914

Quoted from Bartl Is it possible, that %ls and %lc don't work together?

Try replacing the set_highlighted@() calls with calls to winapi function SetFocus().

Usually TAB-key is used for navigating between controls in a dialog window and is handled automatically.

2 Apr 2014 7:14 #13919

Yes, set_highlighted@ is for edit controls and causes a run time failure when used on a combo box. SetFocus() will work in this context.

Also your callback functions should return 2 rather than 1 to avoid a screen refresh.

25 Apr 2014 2:15 #13994

I found an api example with

im = SendMessage(icontrol1(1),EM_SETSEL,0,-1) im = SetFocus(icontrol1(1))

which works very good

Thanks for the help

Please login to reply.