Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Edit in Place: steps to create FileDropCombo 1999-01-11 -- Bob Gaucher Yes I Know most of this is also in the manuals, but here it is in one spot.
Adding FileDropCOMBO functionality to EditInPlace.
After selecting Configure Edit In Place, Select Column Specific.
Select the field in the Browse you wish to use.
Click Use "Application Builder Class?" and select EditDropListClass. Since there is no
EditDropListComboClass we will add functionality to the EditDropListClass to get the
desired results.
Normally, the EditDropListClass is filled from a queue. The name of our queue is NameQ.
It contains one field called NameQ.Name.
Let's assume that you have a file called Names.TPS that contains a list of names that
the user can update. We also have a Key called NAM:Kname using the field
NAM:Name. We have another browse that contains personnel records that we want to
use Edit in Place on called People.TPS. On the field PEO:Name in the People.TPS
file you want to use a FileDropCombo as an edit in place.
At Windows Events.OpenWindow Embed
CLEAR(NameQ) [shp: I think this should be Free(Nameq)]
SET(PEO:Kname)
Loop While NOT Access:Names.Next() AND NOT Access:Names.GetEOF()
NameQ.Name = NAM:Name
ADD(NameQ)
END
This fills the queue so that our drop list has data to use.
Now we modify the EditDropListClass into an EditDropListCOMBO.
Embed in Create Control before the Parent call
SELF.FEQ = CREATE(0,CREATE:DropCOMBO)
Assert(~ErrorCode())
RETURN
This tells it to create a drop COMBO instead of the DropList.
Embed in Init Procedure after Parent Call
SELF.FEQ{PROP:FROM} = NameQ
SELF.FEQ{PROP:TEXT} = ListBox{PropList:Picture,FieldNumber}
SELF.FEQ{Prop:DROP} = 10
SELF.FEQ{PROP:WIDTH} = 80
SELF.FEQ{PROP:Vscroll} = 1
SELF.FEQ{Prop:Format) = `25L@s10@_'
SELF.FEQ{PROP.CAP} = 1
This tells the drop list where to get its data (PROP:FROM) and adds some class to the
drop list.
Embed in Take Event PROCEDURE
LOOP X# = 1 to RECORDS(NameQ)
GET(NameQ,X#)
IF PEO:Name = NameQ.Name THEN BREAK .
END
IF X# > RECORDS(NameQ)
NameQ.Name = PEO:Name
ADD(NameQ)
END
This adds a new name that we might type in into our queue NameQ.
Embed in Kill PROCEDURE with a Priority 1
LOOP Y# = 1 to RECORDS(Names)
GET(Names,Y#)
IF PEO:Name = NAM:Name THEN BREAK.
END
IF Y# > RECORDS(Names)
NAM:Name = PEO:Name
ADD(Names)
END
This adds the new name we entered into our TPS file Names so that it will fill the queue
the next time we want to add a new record or change a record to our People browse.
Steve Parker notes:
Shouldn't the Clear(NameQ) be Free(NameQ).
Also, I would consider building the queue sorted:
Set(NAM:Kname) <=====
Loop while ....
NameQ.Name = NAM:Name
Add(NameQ,NAM:Name) <=====
Then, later, you could improve the efficiency of your Get and
instead of a Loop:
NameQ:Name = PEO:Name
Get(NameQ,NameQ.Name)
If ~ErrorCode()
Break
End
Etc.
Today is November 21, 2024, 3:56 am This article has been viewed 35217 times.
|
|