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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pickreader function in superlib 1

Status
Not open for further replies.

fbizzell

Programmer
Jul 3, 2000
217
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?
 
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
 
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.
 
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
 
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.
 
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
 
Code:
@ [COLOR=red]5[/color red],5 SAY "Select Plant" get mplant send reader:=pickreader(aplant,[COLOR=red]5[/color red],20,10,30)
read

//the pickreader [COLOR=red]box does not display at col 5[/color red], 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
 
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
 
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
 
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
 
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.
 
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
 
Thanks. I would greatly appreciate some sample code how to use the achoice function.

 
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
 
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.

 
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
 
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.

 
Then use when (pre-validation).

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

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:

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
 
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.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top