FW: Browse that scrolls sideways...Yay!!!

John Esak john at valar.com
Thu Mar 10 07:59:24 PST 2005


Yikes!  I hadn't caught that there was no apostrophe in front of the word
prompt  on the code I sent up. Sorry.  My message to you privately below
didn't catch what you were asking either.... well, here is the explanation
anyway... for everyone.  Sorry. :-)
John


Ahh, that comes from an old system I still use.  I mark all my labels on the
"if" line with an apostrophe (a comment).  Then I make sure never to put any
code on the "then" line.  This way I can always add new things to the top of
a routine without having to re-write the label and do all that work.  But
mostly I do this because I only see a tiny portion of the screen at  one
time through that little scope (when I can use it). So,  if I'm running down
the table and I see a line that looks like I can delete it... I do... and
don't realize that there was a label that just got deleted.  This way, I'm
bound to bump into either the label itself or the commented label.  It is
just a style thing for me that helps.  I also do lots of other things people
would think are very strange, like putting "end"  statements on a line by
themselves, and RETURN's too.  This way, I'm never confused when looking
down a table and there is a RETURN (or END) somewhere off the right side of
the screen... or even just very far to the right and visible.  It makes
viewing the code easier for me when I can quickly see these things.  I know
it wastes space and so on, but it has really help my coding to do more
"obvious" things like this. In fact, I also try and stay within  the visible
(cabe editor) area whenever I can. It doesn't hurt the table any and it is
so much clearer to print and put things up here on the list that way.  Can't
always do it, but i try.   Poor Rick, I've asked him to follow my
conventions, too. I'm sure he thinks I'm crazy.  Might as well divulge one
other small trick I've used for the past 5 or 6 years. You will never, ever
see any of my code that does not separate commands along the line without
exactly one semicolon and two spaces.  I religiously follow this style, and
I think it is the single most useful  change I've ever made to my coding
technique. It is as useful as good tabbing in C or shell scripting. Just
makes everything so readable.  I used to put ;'s anywhere with spaces
before, after, two spaces, no space, some space, etc. That  makes for very
sloppy codeing (at least I see it that way now) not to have everything
neatly spaced at a specific interval.  Like I said, this is just my thing,
but I truly believe it would help anyone  as much as it has helped me.
There are some exceptions to the ;-two-space rule and they are optional, but
sometimes when I'm  assigning a lot of variables, for example setting many
of them equal to "" in a "clrvars routine or whatever, that I do a ; and one
space.... but I always think I'm cheating when I do this. :-)  Also, I
declare variables with a comma and just one space (or no space) between the
variables... also feel like  I'm cheating there, too, but it is a place
where I feel saving a little space is more valuable than the style.  All in
all, I have become super anal about how I write my code.  Mostly, it is a
defense against not being able to see the whole screen as a gestalt  like I
used to be able to do... seeing only a character or two at a time has made
me come up with some strange (but useful) stuff.  Like I say, poor Rick. :-)

John





> -----Original Message-----
> From: filepro-list-bounces at lists.celestial.com
> [mailto:filepro-list-bounces at lists.celestial.com]On Behalf Of Robert T.
> Repko (R Squared Consultants)
> Sent: Thursday, March 10, 2005 7:49 AM
> To: Fplist (E-mail)
> Subject: Re: Browse that scrolls sideways...Yay!!!
>
>
> Top posted since it's directed at John.
>
> John,
>
> Nice piece of code.
>
> What's the purpose of the 'prompt' in the condition (If: prompt)?
>
> prompt   If: prompt
>
>
> Believe it or not at 3/9/2005 04:08 PM, John Esak said:
>
> >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:
> >
> >_______________________________________________
> >Filepro-list mailing list
> >Filepro-list at lists.celestial.com
> >http://mailman.celestial.com/mailman/listinfo/filepro-list
>
> ******************************************************************
> *************
> * Robert T. Repko - R Squared Consultants       |   Voice: (610)
> 253-2849     *
> * Serving the Computing World for 20+ years     |     Fax: (610)
> 253-0725     *
> * Windows/Unix/Mac Networking, Cisco, Sonicwall |   email: rtr at
> rsquared.com*
> * NJDOE Provider ID#: 763 | SPIN: 143010681     | Address: 4
> Juniper Ave.     *
> * New Jersey SCC Pre-Authorized                 |
> Easton, PA 18045   *
> ******************************************************************
> *************
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list



More information about the Filepro-list mailing list