Browse that scrolls sideways...Yay!!!
John Esak
john at valar.com
Wed Mar 9 13:08:43 PST 2005
filePro Devotees,
Tony Ryder and I were in the FP Room late last night (pretty much as
always... :-) and having nothing better to do we worked out some nifty code.
This little snippet will allow you to scroll a browse window through many
different views. We took the idea of scrolling left or right and implemented
as if that was what was actually happening... of course, there is no real
sideways movement, but for all intents and purposes the user won't know
that. They'll just think they are scrolling through more fields than were
previously ever available to them.
I've seen some scrolling browses before, but they were pretty intense
affairs using waitkey and etc., kind of disallowing the use of other @bk
keys. This, is different, and (God, dare I say it... a little better)
because it leaves you full flexibility to continue using all of your other
browse keys. We've selected (L)eft and (R)ight to implement the motion
through the views. You can use whatever works for you within the framework
of your already existing keys.
Have fun with this, PLEASE... It is not put up to offer a code punching bag
to those of you who can most certainly write it better, more robustly, etc.
(though we only usually here the claims and never see the actual code...) In
this case, and perhaps for the future, we can all just accept offerings such
as this as a "basis" from which to do our own work and enhancements. ... and
maybe just say Thank You... or offer adjustments, enhancements, opinions in
a friendly, encouraging, helpful manner instead of what has almost always
been the case in the past? Maybe?
I, and others, will always try to make these outreaches, but there is going
to be a time when even the most hearty of us begin to adopt the "Why
bother..." attitude. This forum is constantly on the brink of being
value-less to many who read it... for lots of reasons, not just general
nastiness and flaming... but more because the place gets so Off Topic, and
almost never focuses on plain old filePro. I mean let me say it directly...
to ask a question about "Which is the best Linux platform to buy...."
couched in a "for use with filePro!" wrapper... well, it's why 95% of the
filePro developers and users have gone far a field from here. Once in
awhile, those kinds of topics are helpful and beneficial, but the constant
diet of such things puts most people off. I'm not saying posting actual
filePro code is a panacea for the problems that ail this forum, but it would
certainly go a long way to making things better.
So, because sometimes, it is just easier to see an already developed
starting point... here is one. The colon-delimited version follows at the
end for cutting and pasting this code directly into your system. Comments,
questions, ideas all welcomed...
Sideways Scrolling a Browse
The example sits in the INPUT table of a header file called "test". It
browses into a detail file called "tes_det" via index.A in "test_det". The
key field between the two files is a 6,.0 field. You do not need anything
more than just one record in "test_det" to try the code out and see what it
does. Just add a record to "test" with a key of "111111" and a record in
"test_det" that also has a key field of "111111". (index.A of course). Then
go into "test" and press the T key for Try. It will be self-explanatory from
there. Questions, feel free... either here or jump in the room.
www.tinyurl.com/yuag7
1 Then: end
@keyT If: '@keyT
2 Then:
3 Then: viewflag="1"; gosub view_1
4 Then: gosub prompt
browse If:
5 Then: lookup det=test_det k=("1") i=A -ng b=(b_cfg & b_hdr & b_data)
If: @sk eq "BRKY"
6 Then: exit
If: @bk eq "X"
7 Then: exit
If: @bk eq "L" or @bk eq "R"
8 Then: gosub bld_brw; goto browse
9 Then: goto browse
bld_brw If: 'bld_brw
10 Then:
If: @bk eq "L"
11 Then: viewflag=viewflag - "1"
If: @bk eq "L" and viewflag eq "0"
12 Then: viewflag="3"
If: @bk eq "R"
13 Then: viewflag=viewflag + "1"
If: @bk eq "R" and viewflag eq "4"
14 Then: viewflag="1"
15 Then: gosub (viewflag) of view_1, view_2, view_3
16 Then: return
view_1 If: 'view_1
17 Then:
18 Then: b_cfg="(brw=20 xkey=LRX show=pkeep fill=asc,top)"
19 Then: b_hdr="[These are the headings for View-1]"
20 Then: b_data="*1 *2 *3"
21 Then: return
view_2 If: 'view_2
22 Then:
23 Then: b_cfg="(brw=20 xkey=LRX show=pkeep fill=asc,top)"
24 Then: b_hdr="[These are the headings for View-2]"
25 Then: b_data="*4 *5 *6"
26 Then: return
view_3 If: 'view_3
27 Then:
28 Then: b_cfg="(brw=20 xkey=LRX show=pkeep fill=asc,top)"
29 Then: b_hdr="[These are the headings for View-3]"
30 Then: b_data="*7 *8 *9"
31 Then: return
prompt If: prompt
32 Then:
33 Then: cls("22")
34 Then: showctr("22") "Press \r L \reft or \r R \right to scroll
sideways."
35 Then: showctr("24") "Press \r X \r to exit."
36 Then: return
declist If: 'declist
37 Then:
38 Then: declare viewflag(1,.0)
39 Then: declare b_cfg, b_hdr, b_data
::end:
@keyT:'@keyT::
::viewflag="1"; gosub view_1:
::gosub prompt:
browse::lookup det=test_det k=("1") i=A -ng b=(b_cfg & b_hdr & b_data):
:@sk eq "BRKY":exit:
:@bk eq "X":exit:
:@bk eq "L" or @bk eq "R":gosub bld_brw; goto browse:
::goto browse:
bld_brw:'bld_brw::
:@bk eq "L":viewflag=viewflag - "1":
:@bk eq "L" and viewflag eq "0":viewflag="3":
:@bk eq "R":viewflag=viewflag + "1":
:@bk eq "R" and viewflag eq "4":viewflag="1":
::gosub (viewflag) of view_1, view_2, view_3:
::return:
view_1:'view_1::
::b_cfg="(brw=20 xkey=LRX show=pkeep fill=asc,top)":
::b_hdr="[These are the headings for View-1]":
::b_data="*1 *2 *3":
::return:
view_2:'view_2::
::b_cfg="(brw=20 xkey=LRX show=pkeep fill=asc,top)":
::b_hdr="[These are the headings for View-2]":
::b_data="*4 *5 *6":
::return:
view_3:'view_3::
::b_cfg="(brw=20 xkey=LRX show=pkeep fill=asc,top)":
::b_hdr="[These are the headings for View-3]":
::b_data="*7 *8 *9":
::return:
prompt:prompt::
::cls("22"):
::showctr("22") "Press \r L \reft or \r R \right to scroll sideways.":
::showctr("24") "Press \r X \r to exit.":
::return:
declist:'declist::
::declare viewflag(1,.0):
::declare b_cfg, b_hdr, b_data:
More information about the Filepro-list
mailing list