| SecureUser |
| VERBatim - V25 |
| @ATTACK - @Files.System |
| Advanced Revelation Initialisation Sequence (Overview) by Mike Pope |
| REVMEDIA Revisted |
| Reader's Clinic - Screen Width |
| Screen Grabber |
| Reader's Clinic - Slow Multivalued Screen Display |
| Utility Diskette # 4 |
| Reader's Clinic - Line Length > 256 Characters |
| QTIPS - String Space |
| QTIPS - String Space Format Errors |
| Reader's Forum - Numeric Precision in R/Basic - Hal Wyman |
| QTIPS - @Date.Format |
| @ATTACK - @Date.Format |
| QTIPS - Short Cut Implicit Formatting |
| Utility Diskette # 4 |
| Argument passing - Subroutines and Functions - Mike Pope |
| Caching in on the Frames Array - Mike Pope |
| QTIPS - Fast Dynamic Array Building |
| @ATTACK - @Cursors(x) |
| @ATTACK - @List.Active |
| @ATTACK - @Rec.Count |
| Playing with Scan Codes |
| QTIPS - SET.MACROS - Choosing Active Macro Set |
| Reader's Forum |
RevMedia FKB
| Document | V4I5A3 |
| Title | Version 3 Technical Highlights - Input.Char |
| Keywords | INPUT.CHAR MOUSE VIDEO.RW BORDER.UP INRECT |
| Text | The central system routine for keyboard input has been modified to be "mouse aware" It now returns additional codes permitting the user to know where the mouse was when a button was clicked and what status line button has been pressed Thus there are now five functions of Input Char 1 to handle background processing/@Priority Int etc 2 To return a pressed key 3 To provide the mouse position when a button is clicked 4 To identify the status line cell that has been clicked on 5 To permit clicking on the top screen line to display the menu As 1 and 2 have not changed they will not be dealt WITH here Mouse Position Input Char now accepts a second additional parameter MousePosFlag If this is set to true then if a mouse button is clicked (regardless of which mouse button) a string of length four characters will be returned in the first parameter having the format Char(0) : Char(0) : Char(X) : Char(Y) where X and Y are the ascii values representing the X and Y position of the mouse respectively Thus if the CURSOR was at 65 10 the string returned would be Char(0) : Char(0) : Char(65) : Char(10) Status Line Cells To display custom "mouseable" buttons on the status line requires a knowledge of status record structures All status line images are stored in the SYSTEXT table WITH a row key of Name*Status where Name is the name of the status line image and Status is the literal "Status" e g WINDOW*STATUS In release 3 0 this record has five fields each field being a dynamic array having a structure as follows < 1 > Normally the name of the status line (Name above) although can be DIFFERENT if required < 2 > The information to display in each cell value mark delimited < 3 > Format information for the dynamic section of cell 3 < 4 > Reserved for compiled status line image < 5 > Array of start positions and lengths for active "mouseable" areas of the status line This is a MULTIVALUE for each "mouseable" section of the status line Each multivalue has two subvalues The first being the start position of the area (note the relative position not the absolute position thus the first character is 1 not 0) and the second being the length Thus to define a hot spot WITH 1 at the first character of the status line a hot spot width 10 in the middle of the status line and a hot spot WIDTH one at the far right of the status line field 5 would contain 1ü1ý35ü10ý80ü1 Note that it is the job of the programmer to ensure that hot areas correspond to screen literals As many "hot areas" can be DEFINED as are required by the APPLICATION When a "hot area" is clicked on Input Char returns a string indicating which numbered hot area has been selected This has a similar structure to the X/Y information but is only THREE bytes long in this case Char(0) : Char(0) : Char(X) where X is the position in the "hot area" array It is then the job of the programmer to act upon this information Note that due to the way in which this has been implemented (hot areas are not ASSOCIATED WITH CODE and COMMANDS rather they just tell the calling program which area has been chosen) it is not possible to alter functionality of existing status lines Hot area locations and legends may be changed but choosing hot area 4 in a WINDOW will always display "Options " regardless of the legend/position For reference there are 6 hot areas DEFINED for the Window status line as follows 1 BROWSE previous 2 Browse 3 Browse next 4 Options 5 Softkeys 6 Save The following code shows the use of INPUT CHAR in its modified FORM along with INRECT to provide a "Radio Button" window which takes as input a field mark delimited set of button NAMES and displays a small window allowing the user to mouse to each button to TOGGLE the button status or tab and use the space bar to toggle status Note that in the real world this would be rewritten USING VSPACE but SPACE considerations preclude that here Whilst it would be possible to achieve a similar result USING HOOKS in the window processor this is shown as 3GL code merely to illustrate the use of the new routines and return values FUNCTION Radio_Window(ButtonLabels) /* Author AMcA CC DATE Sept 92 Purpose To display a field mark delimited set of PROMPTS WITH a corresponding radio button for each PROMPT These may be toggled USING mouse and/or tab/spacebar and will return a dynamic array of results when array if Esc or the close button are pressed */ Declare Function Min Max Esc To ATTR InRect Declare SUBROUTINE Msg VIDEO RW BORDER Up Input Char Delay $INSERT SysInclude Logical Equ Escape$ to \1B\ Equ Tab$ to \09\ Equ BackTab$ to \000F\ GoSub SetUp GoSub DisplayScreen GoSub ProcessMouse Return ResultArray SetUp: Colour4 = \1B\:'C1O' Colour1 = Esc To Attr(Colour4) ButtonCtr = Count(ButtonLabels @Fm) + (ButtonLabels#"") ResultArray = str(0:@fm ButtonCtr) ResultArray[ 1 1] = '' Rectangles = '' MaxWidth = 6 ; Pos = 0 ; Mark = 0 ; Screen = "" Ptr = 2 ; DEPTH = ButtonCtr * 2 Ypos = Int((@CrtHigh (Depth+3))/2) ScreenTop = Ypos 2 OldYpos = Ypos Loop Remove NextLabel FROM ButtonLabels At Pos SETTING Mark MaxWidth = Max(MaxWidth Len(NextLabel)) Screen := @(2 Ypos) : NextLabel Ypos += 2 While Mark Repeat For X = 1 To ButtonCtr Screen := @(4 + MaxWidth OldYpos) : "[ ]" ThisBox = Char(5 + MaxWidth) : Char(OldYpos) Rectangles := ThisBox:ThisBox OldYpos += 2 Next BottomLine = ' Screen := @(2 Ypos) : BottomLine Rectangles := Char(3):Char(Ypos):Char(6):Char(Ypos) Rectangles :=Char(3):Char(ScreenTop):Char(3):Char(ScreenTop) OldYpos += 2 Return DisplayScreen: Video RW(1 ScreenTop 7+MaxWidth OldYpos 'R' Image) Video RW(1 ScreenTop 7+MaxWidth OldYpos 'C' ' ':Colour1) Border Up(1 Screentop 7+MaxWidth OldYpos 1 Colour4) Print @(2 ScreenTop):'[':@fm:']' Print Colour4:Screen CurrentButton = 1 Print @(5 + MaxWidth ScreenTop +2): Return ProcessMouse: ExitSet = False$ LOOP Until ExitSet Input Char(Chr True$) Begin Case CASE Len(Chr) = 4 * A Mouse Button was pressed a slight DELAY is in order here ! Delay(0 25) MouseX = Seq(Chr[3 1]) MouseY = Seq(Chr[4 1]) * Now see if the mouse press was somewhere we need to act on RECTANGLE = InRect(MouseX MouseY Rectangles '') Begin Case Case Rectangle = ButtonCtr + 2 * Border "Cancel" icon ExitSet = True$ Resultarray = '' Case Rectangle = ButtonCtr + 1 * ExitSet = True$ Case Rectangle > 0 If ResultArray ResultArray End Else ResultArray End Print @(5+MaxWidth ScreenTop+(Rectangle*2)):Choice Print @(5+MaxWidth ScreenTop+(CurrentButton*2)): End Case Case Chr = Tab$ CurrentButton += 1 If CurrentButton > ButtonCtr then CurrentButton = 1 Print @(5 + MaxWidth ScreenTop + (CurrentButton*2)): Case Chr = BackTab$ CurrentButton = 1 If CurrentButton < 1 then CurrentButton = ButtonCtr Print @(5 + MaxWidth ScreenTop + (CurrentButton*2)): Case Chr = ' ' If ResultArray Choice = ' ' ; ResultArray End Else Choice = @fm ; ResultArray End Print @(5+MaxWidth ScreenTop+(CurrentButton*2)):Choice Print @(5 + MaxWidth ScreenTop + (CurrentButton*2)): Case Chr = Escape$ ExitSet = True$ ; ResultArray = '' End Case Repeat Video RW(1 ScreenTop 7+MaxWidth OldYpos 'W' Image) Return (Volume 4 Issue 5 Pages 7 10) |
Page last modified: 08/02/03