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

Highlighting the Active Record in a Table Frame 1

Status
Not open for further replies.

SercoSteve

Programmer
Sep 25, 2002
44
GB
I have a number of Tables on a Form all of which I am making visible or NOT visible depending on selections made via the form.

The way it works is that the user selects a record on one of the Form Tables and then moves to the next Form Table, which hides the original Table, As I make next table visible I programmatically move to the record I want using a call to moveToRecNo, an example is shown below.

allptlist.PARTS_BOX.MAN_OPT.moveToRecNo(recordNumber)

I move to the record fine, the Table and all linked Tables update correctly. What I need to do is highlight the current record programmatically. so that the user can see what the current record is.

Any suggestions greatly appreciated

Thanks in advanced

Steve
 
Here is some code I picked up from soemwhere a long time ago. I forgot I had until you posted. I tested it and it works fine, except I wasn't too thrilled about the yellow color so I changed it.

----------------------------
You need to add the following to the Var method for your tableFrame:

Code:
Var
  uiRecord        UIObject
endVar

Add the following two methods to the tableframe events Open and Action:

method open(var eventInfo Event)
  doDefault
  uiRecord.attach(self.firstRow)
  self.home()
   ; or I sometimes use self.end()
   ; if I want to start at the end of the table
endmethod

method action(var eventInfo ActionEvent)
  if eventInfo.actionClass() = DataAction then
    uiRecord.color = Transparent
    doDefault
    uiRecord.attach(fldDate.containerName)
     ;change fldDate to some field in your tableFrame record
    uiRecord.color = Yellow
  endIf
endmethod

Then attach the following code to the open event for the record object
in your tableFrame:

method open(var eventInfo Event)
  self.color = Transparent
endmethod

The only other thing to watch is to not name the record object in your table frame, leave it with the Paradox generated name.

-------------------------- Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Steve,

Mac's code is part of the standard solution to the problem, but it's not entirely complete. The complete solution is detailed at and is an updated version of a technique originally developed by Mark Pauker.

Also, if you're working with Paradox 7.32 or later, you can have the highlight color match your current highlight color by replacing Yellow with clHighlight.

Hope this helps...

-- Lance
 
Thanks for your time guys but I have achieved ther desired affect with the following two calls in succession

allptlist.PARTS_BOX.MAN_OPT.moveToRecNo(recordNumber)
allptlist.PARTS_BOX.MAN_OPT.moveTo()

Steve
 
Just one caution when using the record number as an index for navigation: In a multiuser app, if the entire table is not locked, then it may be possible for another user to insert or delete a record during the (short) period between identifying the target record number and actually moving to it. May not apply to your app, but thought I'd throw in my 2 cent.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top