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

EditInPlace

How Validate All EIP Fields on FocusLoss? by Gaudalier
Posted: 30 Jan 02 (Edited 13 Dec 06)

Hello, again, hello!!!!

Something That You Already Know about the EIP:

1. When a Browse Uses EIP for Edit Record, it use the EIP MANAGER, So if you Check in the Embeds, you'll find at Local Objects ->ABC Objects a new brach that goes by the name of EIP Manager for Browse using ?List(BrowseEIPManager). This EIP Manager will do everything concerning to track the EIP for our Browse, altrough as a generic way....

2. So What's to do when you need to do something diferent with an especific EIP's field? You go and ADD your field in COLUMN ESPECIFIC and then you can disable or over-ride something on that field. Again, if you go to the Embeds Local Objects ->ABC Objects you'll find your just added field's branch: EIP Field Manager for Browse using ?List [b] for field "SOME:FIELD"(EditEntryClass)[/b]. Into this Branch, there is another sub-branch TakeEvent PROCEDURE(Unsigned Event),BYTE,VIRTUAL Where is the place we track the field's behavior.

        An Example????
Our Account System manages too many customer's credit balances: Payment & loans. So there is a browse in wich we select or type the Customer's code, and we can introduce in either fields, Payments or Loans, any amount. We wanna Call a SelectWindows when the User dobleClik on the CustomerCode field to select it from a Select Windows. Plus not Allowing to change the Customer's Code ONCE it was save AND changing the default backgrond color to Yellow as a matter of Visual sing.

First we add an alert to the field's dobleclick this way (our field's name: CUSAC:CustomerCode):

Local Objects ->ABC Objects ->EIP Field Manager for Browse using ?List for field CUSAC:CustomerCode EditEntryClass) ->SetAlerts PROCEDURE,VIRTUAL

CODE at priority 7500 *

CODE

SELF.Feq{PROP:Alrt,255} = Mouseleft2 !DobleClick alert

-See Clarion's Help for PROP:Alrt,255

and into our belove brach ->TakeEvent PROCEDURE(Unsigned Event),BYTE,VIRTUAL

CODE at priority 2500 **

CODE

CASE EVENT()
  OF EVENT:SELECTED
    IF BRW1.Q.CUSAC:CustomerCode <> '
      Self.Feq{PROP:COLOR,1} = 0D1FEFCH
      Self.Feq{PROP:COLOR,2} = 0
      Self.Feq{PROP:COLOR,3} = 0D1FEFCH
      Self.Feq{PROP:SelStart} = 1
      Self.Feq{PROP:ReadOnly} = 1
    ELSE
      Self.Feq{PROP:SelStart} = 1
      Self.Feq{PROP:ReadOnly} = 0
    END

    Self.Feq{PROP:REQ} = TRUE
    Self.Feq{PROP:IMM} = TRUE
    UPDATE(SELF.FEq)
  OF EVENT:ALERTKEY
      CASE KEYCODE()
        OF MouseLeft2
          GlobalRequest = SelectRecord
          BrwCustomerWindow          
          IF GlobalResponse = RequestCompleted
           BRW1.Q.CUSAC:CustomerCode=CUS:CustomerCode  
           DISPLAY
           RETURN(EditAction:Forward)
          ELSE
            Clear(CUS:Record)
            Display
            Return(EditAction:None)
          END !END IF GlobalResponse = Reques
      END !CASE


and again into our belove brach ->TakeEvent PROCEDURE(Unsigned Event),BYTE,VIRTUAL

CODE at priority 7500 ***

CODE

UPDATE(SELF.Feq) ! 7500  
IF ReturnValue AND ReturnValue <> EditAction:Cancel AND| EditInPlace::CUSAC:CustomerCode.ReadOnly = 0

  CUS:CustomerCode = BRW1.Q.CUSAC:CustomerCode
  IF Access:Customer.Fetch(CUS:AK_Codigo) = Level:Benign
    BRW1.Q.CUSAC:CustomerCode = CUS:CustomerCode
    DISPLAY
    RETURN(EditAction:Forward)
  ELSE
    GlobalRequest = SelectRecord
    BrwCustomerWindow          
    IF GlobalResponse = RequestCompleted
      BRW1.Q.CUSAC:CustomerCode=CUS:CustomerCode  
      DISPLAY
      RETURN(EditAction:Forward)
    ELSE
      Clear(CUS:Record)
      Display
      Return(EditAction:None)
    END
  END
END !END IF ReturnValue..


Well, to ordering our requeriments:
A) DobleClick in our EIP CusAc:CustomerCode will do a LookUp/Select. (in case of we dunno the CustomerCode)

B)When Inserting a new record, the EIP CusAc:CustomerCode Will allow us to capture the CustomerCode.

C)Once the record has a valid CustomerCode, and it was saved, Change the CustomerCode will not be ALLOWED And HighLigted with Yellow color wich is a way to tell "You Can't change me".
 

Explanation of Code:

A)* To manage the DoubleClick Event, we need first to set an ALERT to the EIP Field, as you know, SELF.Feq{PROP:Alrt,255} = Mouseleft2 will add an Alert to Mouse DoubleClick on our field, wich can be manage by embed code ** When EVENT() =  EVENT:ALERTKEY, and KEYCODE() = Mouseleft2. That Code, very simple!.

B) & C)As we can't disable the Field (if ya know it, tell me how), we surely can set the Field's property to READONLY.

Well, the only way to do color (HihtLight when NOT Blank), is by changing the background color when the FIELD IS SELECTED,**, When EVENT() = EVENT:SELECTED AND BRW1.Q.CUSAC:CustomerCode <> ', we change the colors:
Self.Feq{PROP:COLOR,1} = 0D1FEFCH, etc. etc.

AT WHERE THE FOCUS LOSS FITS INTO????

Well, our Customer's Credit Balance, has a field CUSAC:Payment and CUSAC:Loan, wich are EXCLUSIVE, ergo, you can capture either Payment or Loan, but not both.

That problem is why this FAQ is made for: we'll use the event FocusLoos to verify that CUSAC:Payment XOR CUSAC:Loan is correct.

But not today...


Well, It's Today ;)

You'll need a BYTE variable, let's name it LOC:AllowFocusLoss to track down the focus loss event and a LONG variable to save the last FEQ using the EIP control: LOC:EIPFEQ

Go to Local Objects ->ABC Objects ->EIP Field Manager for Browse using ?List (BrowseEditManagerClass)->Take FocusLoss PROCEDURE,VIRTUAL

Put thi code at priority 2500

CODE

IF LOC:AllowFocusLoss = FALSE   !NO permitir salir del EIP
    SELECT(LOC:EIPFEQ)
    PRESSKEY(TABKEY)
    RETURN
END

And again into our beloved EIP branch blah.. blah.. for field CUSAC:CustomerCode EditEntryClass) ->TakeEvent PROCEDURE(Unsigned Event),BYTE,VIRTUAL


CODE

LOC:AllowFocusLoss = FALSE
LOC:EIPFEQ = Self.Feq
Update(Self.Feq)
CASE EVENT()
    OF EVENT:Selected
        IF BRW1.Q.CUSAC:CustomerCode <> '
            LOC:AllowFocusLoss = TRUE
        ELSE
            LOC:AllowFocusLoss = FALSE
        END
    OF EVENT:Accepted
        IF BRW1.Q.CUSAC:CustomerCode <> '
            LOC:AllowFocusLoss = TRUE !Good boy!!!
            RETURN(EditAction:Complete)
        ELSE
            LOC:AllowFocusLoss = FALSE
            BEEP   !You B*st*rd, type down an Custumer code!
            Return(EditAction:None)

        END
END


Of Course ya must select NEVER on "action upon focus loss" in the configure Edit in Place windows.



Best Regards.





 





Back to SoftVelocity: Clarion solutions FAQ Index
Back to SoftVelocity: Clarion solutions Forum

My Archive

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