soccer jersey forums.silverfrost.com :: View topic - ENTER key instead of TAB key
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ENTER key instead of TAB key

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: M�nchen

PostPosted: Fri Dec 18, 2009 3:09 pm    Post subject: ENTER key instead of TAB key Reply with quote

Paul,
how can I jump from one input to the next with the ENTER key and back e.g. with the Cursor up key instead of the default TAB key?

Code:

winapp 0,0
      program apac
     
      implicit none
      include<windows.ins>

      integer*2 i
      integer*4 number1, number2, number3
      external num1,num2, num3
       
     open(99,file='test2.dat')
      number1 = 11
      number2 = 12
      number3 = 13
 
      i=winio@('%ap&', 2, 6)
      i=winio@('%ca[Test zur Eingabe]&')
      i=winio@('%bg[grey]&')
      i=winio@('Eingaben: &')
      i=winio@('%ap&', 12, 6)
      i=winio@('%^10rd&',number1, num1)
      i=winio@('%ap&', 12, 8)
      i=winio@('%^10rd&',number2, num2)
      i=winio@('%ap&', 12,10)
      i=winio@('%^10rd' ,number3, num3)
      stop
      end

      integer function num1()
      implicit none
      include<windows.ins>
      write(99,9001)
 9001 format(1x,'num1 wurde aufgerufen')
      num1 = 2
      return
      end   
     
         
      integer function num2()
      implicit none
      include<windows.ins>
      write(99,9002)
 9002 format(1x,'num2 wurde aufgerufen')
      num2 = 2
      return
      end   
     
      integer function num3()
      implicit none
      include<windows.ins>
      write(99,9003)
 9003 format(1x,'num3 wurde aufgerufen')
      num3 = 2
      return
      end   
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Fri Dec 18, 2009 5:04 pm    Post subject: Reply with quote

Bartl,

For many of us, the Enter key does seem more logical than the Tab key, but that's not how Windows does it. If you write a program so blatantly in contradiction of the way Windows does things, it will annoy your users. If you are programming entirely for yourself, trust me, it will even annoy you eventually that your program works differently to (say) Microsoft Office and every other application you use!

In my experience, if it is truly difficult in Clearwin it is because you are violating a standard.

Regards

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2876
Location: South Pole, Antarctica

PostPosted: Sat Dec 19, 2009 2:14 am    Post subject: Reply with quote

If this would bother me very much i'd try to implement that using cursor and focus monitor utilities of Clearwin. Needed keyboard key handling using Windows messaging we discussed here couple months ago, it can be done just with this line and appropriate callback keyb_func
i=winio@('%mg&', WM_KEYDOWN, keyb_func)

As to Eddies comment, yes, Windows distorting us so we have to substitute our own common sense wishes sometimes. Now i subconsciously and automatically try to push final Y (Yes) when close SDBG while it was programmed to respond on E (Exit). And i understand why -- the key E is closed to Alt+X and can be pressed with minimal movement of left hand. But Windows already made out of me its zombie. And i do mistype that key like the laboratory mice with electrodes in the brain 100 times a day and at the end become very unhappy with myself and "non-standard" debugger.

( Paul, if you read this, can you please make closing the debugger confirmation window also responding on Yes ? TIA Smile )
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Sat Dec 19, 2009 12:50 pm    Post subject: Reply with quote

To pick up on Dan, I get particularly incensed by the way a mouse double-click is preceded by a single click, which means that I have to respond to a single left click with something benign (harmless) rather than something useful (and therefore un-Windows like). In this case I am forced to make my software behave differently to my other favourites ....

Eddie
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Sun Dec 20, 2009 3:07 pm    Post subject: Reply with quote

It would be useful to be able to use the Enter key and the cursor up & down keys to move around an input form. Other programs I use seem to manage that. To do that you would have to be able to set which control has focus - is there a subroutine to do that. I've looked through the help and can't find one.

There is another problem with Clearwin+. When you are entering some data in a control, and you select another application for a while and then, switch back, the first control on the input form becomes active and not the one that was previously active.

Is it also possible to determine and set the cursor position within a %rs, %rd & %rf control?

Ian
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8036
Location: Salford, UK

PostPosted: Mon Dec 21, 2009 12:36 pm    Post subject: Reply with quote

I cannot give you a comprehensive response to this thread at the moment.

However, I am aware of the failure to resume the focus when returning to a ClearWin+ application. I have not been able to find a way to fix this.

The TAB behaviour is what you get automatically from the Windows API. ENTER is mostly used to close a dialog. In a Microsoft Windows environment anything else would be counter-intuitive for the seasoned user.
Back to top
View user's profile Send private message AIM Address
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: M�nchen

PostPosted: Wed Dec 23, 2009 3:30 pm    Post subject: Reply with quote

Hello, thanks for your help.

The reason for my question:
We have to input a lot of numerical data and we will do it only with the right hand on the numerical pad on the keyboard.
So it�s very annoying und slowly, to jump from one input to the next with the TAB key.

Merry Christmas and a happy New Year
Bartl
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2593
Location: Sydney

PostPosted: Thu Dec 24, 2009 12:36 am    Post subject: Reply with quote

If it's a lot of data then why not first enter all the data into a spreadsheet.
This will provide you with easy entry, using all the features of excel, and hopefully help define a structured approach to the data.
Then "import" the data into your program.
I write out the data from excel, by saving the file as a .prn or .csv file.
Both these layouts can be easily read with fortran format statements.

For example, if you set the column widths to 5 10 10 9, then a .prn file can be easily read using:
1001 FORMAT (bn, I5,2f10.0,a9)

I've always wanted to read data directly from a .xls or .xlsx file, but don't have access to a library of routines that can do this easily.

John
Back to top
View user's profile Send private message
qt



Joined: 23 Aug 2005
Posts: 46
Location: Berlin, Germany

PostPosted: Thu Jan 07, 2010 12:34 pm    Post subject: Reply with quote

DearJohn,

regarding reading .xls files, maybe qtXLS helps:

http://www.qtsoftware.de/vertrieb/db/qtxls_e.htm

A trial version allows to read/write 50 rows, so you can check if this works for you.

Kind regards,

J�rg Kuthe
QT software
Back to top
View user's profile Send private message Visit poster's website
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Sat Jan 09, 2010 10:55 am    Post subject: Reply with quote

I sort of agree and disagree with the usage of tabs and enter. In the data entry of numerical data, it is quite easy to do the majority of entry from the numeric keypad with your right hand, and set up the OK button to be the default button to store/process the data i.e. '%`tt[OK]'. Use the left hand on the tab key.

However, if the enter key could be detected using a keyboard monitor (which it can't) and the id of the data entry field detected (which it can be) then your proposal would work. Unfortunately, I tried a simple program for this and the Enter key does not seem to be detected by the keyboard monitor call back. The Return key acts the same. However, Control+M which is a carriage return character is detected, but requires too many fingers to make it simple.

Using the "Enter" as an accelerator key and detecting if the last control is active does work. Move to the next control under the control of a callback is achieved with set_highlighted@. To select the text in the first control, it is necessary to call window_update and not just allow the update that occurs on return from the callback with ienter_monitor = 1. The keyboard monitor bits are not required but are shown for information.

Ian
PS here is the code I tried, but as the enter key did not respond to the keyboard monitor, I tried the 'Plus' key as a demo. The demo also responds to Enter using the %ac function.
Code:

winapp
program keyboard_monitor_program
implicit real*8 (a-h,o-z)
include <windows.ins>
external keyboard_monitor,ienter_monitor
common/data_stuff/data1,data2,data3
common/focus_control/ifocus,ncontrol,icontrol(100)
i=ifw()
call add_focus_monitor@(ifw)
call add_keyboard_monitor@(keyboard_monitor)
data1 = 0d0
data2 = 0d0
data3 = 0d0
ncontrol = 3
i=winio@('%ca[Keyboard monitor]&')
i=winio@('%ac[Enter]&',ienter_monitor)
i=winio@('%ff%rf%lc&',data1,icontrol(1))
i=winio@('%ff%rf%lc&',data2,icontrol(2))
i=winio@('%ff%rf%lc',data3,icontrol(3))
call remove_focus_monitor@(ifw)
end
integer*4 function keyboard_monitor()
implicit real*8 (a-h,o-z)
include <windows.ins>
common/data_stuff/data1,data2,data3
keyboard_monitor=1
ikey = clearwin_info@('KEYBOARD_KEY')
if(ikey .eq. 43)then
!plus key pressed so process data and clear input
  print *,data1,data2,data3
  data1 = 0d0
  data2 = 0d0
  data3 = 0d0
endif
end
integer*4 function ienter_monitor()
implicit real*8 (a-h,o-z)
include <windows.ins>
common/data_stuff/data1,data2,data3
common/focus_control/ifocus,ncontrol,icontrol(100)
ienter_monitor=1
!enter key pressed so process data and clear input
if(ifocus .eq. icontrol(ncontrol))then
!process the data
!  print *,'enter in last field',data1,data2,data3
  data1 = 0d0
  data2 = 0d0
  data3 = 0d0
  call window_update@(data1)
  call window_update@(data2)
  call window_update@(data3)
  call set_highlighted@(icontrol(1))
else
!or move to next field
 do i=1,ncontrol-1
  if(ifocus .eq. icontrol(i))then
    call set_highlighted@(icontrol(i+1))
    exit
  endif
enddo
endif
end
integer*4 function ifw()
include <windows.ins>
common/focus_control/ifocus,ncontrol,icontrol(100)
ifw=2
ifocus=clearwin_info@('FOCUSSED_WINDOW')
end
Back to top
View user's profile Send private message Send e-mail
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Wed Jan 13, 2010 12:27 pm    Post subject: Reply with quote

And of course if you want it to repond to cursor up and cursor down as well, then the program looks like this:
Please comment
Ian
Code:

winapp
program keyboard_monitor_program
implicit real*8 (a-h,o-z)
include <windows.ins>
external keyboard_monitor,ienter_monitor, &
          iup_monitor,idown_monitor
common/data_stuff/data1,data2,data3
common/focus_control/ifocus,ncontrol,icontrol(100)
i=ifw()
call add_focus_monitor@(ifw)
call add_keyboard_monitor@(keyboard_monitor)
data1 = 0d0
data2 = 0d0
data3 = 0d0
ncontrol = 3
i=winio@('%ca[Keyboard monitor]&')
i=winio@('%ac[Enter]&',ienter_monitor)
i=winio@('%ac[UP]&',iup_monitor)
i=winio@('%ac[DOWN]&',idown_monitor)
i=winio@('%ff%rf%lc&',data1,icontrol(1))
i=winio@('%ff%rf%lc&',data2,icontrol(2))
i=winio@('%ff%rf%lc',data3,icontrol(3))
call remove_focus_monitor@(ifw)
end
integer*4 function keyboard_monitor()
implicit real*8 (a-h,o-z)
include <windows.ins>
common/data_stuff/data1,data2,data3
keyboard_monitor=1
ikey = clearwin_info@('KEYBOARD_KEY')
if(ikey .eq. 43)then
!plus key pressed so process data and clear input
  print *,data1,data2,data3
  data1 = 0d0
  data2 = 0d0
  data3 = 0d0
endif
end
integer*4 function ienter_monitor()
implicit real*8 (a-h,o-z)
include <windows.ins>
common/data_stuff/data1,data2,data3
common/focus_control/ifocus,ncontrol,icontrol(100)
ienter_monitor=1
!enter key pressed so process data and clear input
if(ifocus .eq. icontrol(ncontrol))then
!process the data
!  print *,'enter in last field',data1,data2,data3
  data1 = 0d0
  data2 = 0d0
  data3 = 0d0
  call window_update@(data1)
  call window_update@(data2)
  call window_update@(data3)
  call set_highlighted@(icontrol(1))
else
!or move to next field
 do i=1,ncontrol-1
  if(ifocus .eq. icontrol(i))then
    call set_highlighted@(icontrol(i+1))
    exit
  endif
enddo
endif
end
integer*4 function iup_monitor()
implicit real*8 (a-h,o-z)
include <windows.ins>
common/data_stuff/data1,data2,data3
common/focus_control/ifocus,ncontrol,icontrol(100)
iup_monitor=1
!cursor_up  pressed so move to previous field or stay at top field
do i=2,ncontrol
 if(ifocus .eq. icontrol(i))then
   call set_highlighted@(icontrol(i-1))
   exit
 endif
enddo
end
integer*4 function idown_monitor()
implicit real*8 (a-h,o-z)
include <windows.ins>
common/data_stuff/data1,data2,data3
common/focus_control/ifocus,ncontrol,icontrol(100)
idown_monitor=1
!cursor_up  pressed so move to previous field or stay at top field
do i=1,ncontrol-1
 if(ifocus .eq. icontrol(i))then
   call set_highlighted@(icontrol(i+1))
   exit
 endif
enddo
end
integer*4 function ifw()
include <windows.ins>
common/focus_control/ifocus,ncontrol,icontrol(100)
ifw=2
ifocus=clearwin_info@('FOCUSSED_WINDOW')
end
Back to top
View user's profile Send private message Send e-mail
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: M�nchen

PostPosted: Thu Jan 14, 2010 9:22 am    Post subject: Reply with quote

Ian,
thank you very very much for this solutions, it seems to be the right way for further developments.
For me as beginner with clearwin it's very difficult and complex to find such solutions.

Thanks
Bartl
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Sun Sep 01, 2013 12:42 pm    Post subject: Reply with quote

Using the cursor to move up and down was described in the following post:
http://forums.silverfrost.com/viewtopic.php?t=1509&highlight=
Ian
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Sun Sep 01, 2013 2:06 pm    Post subject: Reply with quote

Ian,

I think you meant to post your comment to the other thread!

SET_HIGHLIGHTED@ is probably different to SetFocus. Your code replaced TAB, but if the fields are laid out in a grid, Up and Down arrows are not just the next field. Left and Right arrows are already committed to use within the field.

Eddie
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Sun Sep 01, 2013 2:34 pm    Post subject: Reply with quote

Thanks Eddie,
You are right, I meant to post it elsewhere.
Up and down arrows are OK for those directions and Tab and Shift+Tab for the horizontal movement.
Ian
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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