INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Pickreader function in superlib

Pickreader function in superlib

(OP)
I am using an old library called superlib.  It had a function for pickreader to get input into a get using an array of values.  The pickreader function works but it does not allow you to move the popup list to specified coordinates on the screen.  It is suppose to but no matter what you enter as the coordinates the screen appears in the same place.  Does anyone have a fix for this?

RE: Pickreader function in superlib

Are you passing only the top and left coordinates? Try pasteing your line of code that calls the function.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
Here is the code.

mplant:=space(4)
aplant:={"D Drier","E Ennis","F Fittings"}
@ 5,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,5,20,10,30)
read

//the pickreader box does not display at col 5, but display
//at col 8.  
//no matter what I put in it displays it someplace else.

RE: Pickreader function in superlib

Have you tried only passing the top and left? i.e.

CODE

pickreader(aplant,5,20)
I have the final version of Superlib 3.5 with Norton Guide. What version are you using?

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
I will try that but if you compile and link my code what do you get?

I am also using the final version Superlib 3.5

Do you have the source code for the pickreader function?  Perhaps that could be corrected and recompile and linked, and put in a library of its own.

RE: Pickreader function in superlib

I have the code. I'll look at the code this evening.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

CODE

@ 5,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,5,20,10,30)
read

//the pickreader box does not display at col 5, but display
//at col 8.  
//no matter what I put in it displays it someplace else.

As your code is written it should display in column 20. The operand order for this function is top,left,bottom,right. That should put it at row 5 (which is covering your get object - not good), and at column 20.

If I were you I would place the reader as such:

CODE

@ 5,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,6,17)
This will place the list one row below the get object and in its same column. Then the tBrowse object will calculate the bottom and right for you.

Hope this helps.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
I intended to say that the display of the pickreader box is at row 8.  I tried your code and it also display at row 8, not 6.  

This is the code I used:

mplant:=" "
aPlant:={"D Drier","E Ennis","F Fittings"}
@ 5,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,6,17)
read
 

RE: Pickreader function in superlib

I'm looking at the tbrowse code now...

Try this and tell me where the top and left are printed:

CODE

pickreader(aplant)

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

I have to start my commute home. I'll check back in 1-2 hours.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
I appreciate your help very much.  If you have Clipper and Superlib library still and have the time please compile and run this code and you will see that the list displays at the same exact location for all 4 of the sample pickreader boxes in this code:

*testread.prg  program to test the placement of list boxes for the pickreader in SuperLib
clear
@ 0,0 say "row 0"
@ 1,0 say "row 1"
@ 2,0 say "row 2"
@ 3,0 say "row 3"
@ 4,0 say "row 4"
@ 5,0 say "row 5"
@ 6,0 say "row 6"
@ 7,0 say "row 7"
@ 8,0 say "row 8"
@ 9,0 say "row 9"
@ 10,0 say "row 10"
mplant:=" "
aPlant:={"D Drier","E Ennis","F Fittings"}
@ 3,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,4,17)
read

mplant:=" "
aPlant:={"D Drier","E Ennis","F Fittings"}
@ 3,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant)
read


mplant:=" "
aPlant:={"D Drier","E Ennis","F Fittings"}
@ 5,5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,6,17)
read

mplant:=" "
aPlant:={"D Drier","E Ennis","F Fittings"}
@ 10,5 SAY "Select Plant           " get mplant send reader:=pickreader(aplant,11,28)
read


//If you compile and run this code you will see that the list box display
//at the exact same location all 4 times. It always puts the list at row 9 and at the same column
//no matter what you have as the coordinates.
//apparently the author of this code put something in the source code that
//ignores the coordinate or he has hard coded them in.

RE: Pickreader function in superlib

I've looked at all of the pickreader code and just can't spot it. It sure does center the list no matter what you try to pass for top and left.

My best guess is that he is resetting static ntop and nleft to be screen centered somewhere in the get or mouse  event handlers and not realizing the var name conflict.

Have you thought of putting your own achoice function on the valid parameter of the get object? That's how I always did it. It's not hard. I could send you some example code. That way you wouldn't be trying to modify this old unsupported library.

Let me know if I can help further...

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
Thanks.  I would greatly appreciate some sample code how to use the achoice function.  

RE: Pickreader function in superlib

Usage:

CODE

@ 15,44 say 'Felony:' get MFELonY picture '@!' valid v_fel()
Function:

CODE

function v_fel
xc:=col()-len(mfelony)
xr:=row()
declare wch[4]
wch[1]:='F - Felony'
wch[2]:='? - Unknown'
wch[3]:='N - None'
wch[4]:='B - Both'
for xk:=1 to 4
    if mfelony=left(wch[xk],1)
       return .t.
    endif
next
save screen to vfel_scr
scroll(12,30,17,50,0)
@ 12,30 to 17,50 double
vfel:=achoice(13,31,16,49,wch)
if vfel==0
   restore screen from vfel_scr
   return .f.
endif
mfelony:=left(wch[vfel],1)
restore screen from vfel_scr
@ xr,xc say mfelony
return .t.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
Thanks for the code but you mentioned earlier the use of the achoice function.  Is that more like the pickreader function.  Using the Valid parameter does not pop up the list, unless you put in an invalid entry or try to use a blank.  Not bad but not actually what I am looking for.

I can understand if you no longer have anymore time to spend on this.  I appreciate the help you have given already.

RE: Pickreader function in superlib

That function does use achoice:

CODE

vfel:=achoice(13,31,16,49,wch)

You are right, that one opens when an invalid choice is made. What condition are you after for a trigger?

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
When the cursor gets to that field I would like the list to popup, or as soon as the read is executed.

I didn't realize the achoice function was a part of the valid parameter.

RE: Pickreader function in superlib

Then use when (pre-validation).

CODE

@ 15,44 say 'Felony:' get MFELonY picture '@!' valid v_fel()

Quote:


I didn't realize the achoice function was a part of the valid parameter.

achoice is just a clipper function I used in the User Defined Function I wrote and passed to the valid parameter of the @ Get command.

You can pass any function to GET - VALID/WHEN as long as it returns true or false. Here is the Clipper 5.3 documentation:

Quote:


      WHEN <lPreExpression> specifies an expression that must be satisfied
      before the cursor can enter the GET during a READ.  The expression can
      optionally be a code block.  The GET object is passed as a parameter to
      the code block.

      VALID <lPostExpression> specifies an expression that must be
      satisfied before the cursor can leave the GET during a READ.  The
      expression can optionally be a code block.  The GET object is passed as
      a parameter to the code block.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
Your latest is a little too technical for me.  I guess I will have to stick with the unsupported and unchangeable pickreader function.  I don't have the skills needed to use the achoice function.

RE: Pickreader function in superlib

SORRY, I should have wrote:

CODE

@ 15,44 say 'Felony:' get MFELonY picture '@!' when v_fel()
Maybe that will hep.

It's not that complicated... I'll send you an explanitation this evening...

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

(OP)
I guess I will have to stick with the unsupported and unchangeable pickreader function.  I don't have the skills needed to use the achoice function.

RE: Pickreader function in superlib

(OP)
Ignore my last post.  I didn't realize you had already answered it.  I will be happy if you send an explanation later.

RE: Pickreader function in superlib

OK, lol.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

RE: Pickreader function in superlib

Hope this helps:

CODE


//I'm going to cut out what you don't need to use it as a when function.

function v_fel            //Name of function - can be in any module
                //(prg file) of your application
xc:=col()-len(mfelony)        //memvar xc holds the column number of
                //the first column in the get because the
                //col() function returns the current
                //screen column, which is the cursor
                //position after the get is printed.
xr:=row()            //memvar xr holds the current screen row.
declare wch[4]            //memvar wch is an array with 4 rows
wch[1]:='F - Felony'        //row one of wch, stores a text string.
wch[2]:='? - Unknown'        //row two of wch, stores a text string.
wch[3]:='N - None'        //row three of wch, stores a text string.
wch[4]:='B - Both'        //row four of wch, stores a text string.
save screen to vfel_scr        //Saves the contents of the screen where
                //the popup will display to memvar vfel_scr
scroll(12,30,17,50,0)        //sets a scrolling area where popup
                //will display
@ 12,30 to 17,50 double        //draws douple line box on area where popup
                //will display.
vfel:=achoice(13,31,16,49,wch)    //achoice lets you pass top,left,bottom,right
                //screen coordinates notice coordinates are
                //inside of the screen save and the box
                //the 5th parameter is a memvar (vfel) that
                //will hold the pick list row the user
                //selected, or zero if they hit escape.
if vfel==0            //if they hit escape
   restore screen from vfel_scr    //restore screen to previous state
   return .f.            //abandon function and sent .f. to the get
                //handler; this should make the previous get
                //active. Test it and see... if not it will
                //simply re-launch this function. Let me know
                //if the behavoir at this point works for you.
endif    
mfelony:=left(wch[vfel],1)    //set value of the get variable to the first
                //character of the row selected
restore screen from vfel_scr    //restore screen to previous state
@ xr,xc say mfelony        //at the screen positions of the get print
                //the first character of the row selected
return .t.            //return .t. to the get stack. this will make
                //the mfelony get in focus with the
                //pre-validation satisfied.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel.  Covey

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close