Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1) Is it possible to stop editing a 1

Status
Not open for further replies.

DEBUINFO4GL

Programmer
Nov 12, 2003
3
SG
1) Is it possible to stop editing an entry field.?

Scenario:
Customer name field is an entry field and there is a pop up for this field. User is not allowed to edit the data (only he can select the data from pop up by using Control - Z).

2)In a pop up window if I press “D” the cursor should jump to the record where the First character matches with “D”. is that possible?
 
1) Since you need to enter the field in order to execute the popup, you can't make the field noentry. What you can do is in the BEFORE FIELD section save the value of the field in a variable (even if its null) call it g_variable.

Assuming you call a function to do your lookup (control-z), return that value into g_variable. In the AFTER FIELD section, always set the input variable back to g_variable in case the user changed it.

OFF TOPIC: In some unix variants, i.e. SCO V, Solaris, the control-z is the default value for:

stty susp ^z

With this set, pressing control-z suspends the job in the backgroud. This takes prescendence over 4GL. To change this, place:

stty susp ""

somewhere in your /etc/profile, .profile, or the shell script that starts your application.


2) You can do this, but not easily. I once did something similar in a 4GL menu program. I created a 1-char noentry field which was the first character of the record. The 4GL was rather involved, but it did work. If you are interested, I think I can find it and post it here.

Regards,


Ed
 
Hi,

1. If the data comes from a lookup for customer name field; it would be better to activate the popup in the before field part of the input statement. In the after field section, issue a next field statement and transfer the control to next logical input field. This way user will save many key taps (control-z etc.)

2. Here is a sample 4gl program and form source code, which activates a lookup window (popup) and jumps to a location as requeted by an user. DISPLAY ARRAY uses hotkey F1 or control-w to get the alpha/expression (could be more than one character) from an user and jumps into very first occurance of data using FGL_SETCURRLINE() in-built function (version 7.3 feature).

--popup.4gl
database testdb
main
call popup()
end main

function popup()
define cmd char(500),
test_arr array[900] of
record
menu_item like systables.tabname
end record,
i,j,k int, expr,alpha,p_alpha varchar(10)

let k=10 --number of characters needed as item hot keys, initialize this with 1 if you need to only the first alpha as a hot key to be trapped.

options form line first, prompt line last

let cmd="select tabname from systables where tabid>99 order by 1"
prepare id1 from cmd
declare cur1 cursor for id1
free id1

create temp table x (alpha varchar(10), lno int) with no log
let cmd="select lno from x where alpha matches ?"
prepare id2 from cmd
declare popcur cursor for id2
free id2

let i=1
let p_alpha="!"
open cur1
while(1)
fetch cur1 into test_arr.*
if status=notfound then
exit while
end if
let alpha = test_arr.menu_item[1,k]
if alpha != p_alpha then
insert into x values (alpha,i)
let p_alpha= alpha
end if
let i=i+1
if i>900 then exit while end if
end while
call set_count(i-1)
close cur1

open window w1 at 2,5 with form "popup"
display array test_arr to s_scr.*
on key(f1,control-w)
prompt "Jump to: " for expr
let expr=expr clipped, "*"
open popcur using expr
fetch popcur into j
if status=0 then
call fgl_setcurrline(1,j)
else
error "menu item starting with ", expr, " not found."
end if
end display

end function

--popup.per
database formonly
screen size 24 by 80
{
++ Menu (Demo) ++
\g-----------------------------
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
[a ]
\g-----------------------------

}

attributes
a = formonly.tabname;
instructions
screen record s_scr [15] (tabname);

Regards,
Shriyan
"It is simple to make things complex, but complex to make things simple."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top