Edittable: SELPOS and ACCESSPOS (OpenInsight 32-Bit)
At 22 APR 2002 10:10:35PM David Kafka wrote:
I am starting to jump into the edittable big time now. If it helps the edittable is a product/description/quantity/price/extension type of scenario.
Some questions:
1. What's the difference between SELPOS and ACCESSPOS?
2. Extension is a symbolic (quantity*price). When it recalculates, I need to send a CALCULATE event to another control in the window. Obviously, it recalculates if either price or extension for the row changes. How do I most easily capture the fact that this has occurred? Do I use the CHANGED event, and then check to see which column I am in to decide if EXTENSION has changed? Or, do I use the POSCHANGED event and see if price or quantity has changed. 3. My last question leads to: how do I detect if a particular cell's value has changed? It seems what is needed is the equivalent of a GOTFOCUS and LOSTFOCUS on each cell, but we only have POSCHANGED, right? If I am in POSCHANGED, how the heck to I access the original value of the cell I just left? 4. What is the best way to have Edittable-Column-based logic remain valid if I decide to re-order the columns in the edittable? (That is, if column 3 is now quantity, and I need to act on that, but later on I insert a column ahead of it, for example.) Any help would be appreciated. (By the way, I have studied the large CellHell exchange.) Thanks, David Thanks, David </QUOTE> —- === At 23 APR 2002 03:44AM Donald Bakke wrote: === <QUOTE>David, 1. What's the difference between SELPOS and ACCESSPOS? SELPOS sets or returns the position of the cursor (i.e. highlighted cell) that the user sees. ACCESSPOS sets or returns an internal position/pointer that does not necessarily correspond with what the user sees. You would use ACCESSPOS if you wanted the data in a specific cell (in conjunction with ACCESSDATA) without moving the cursor from the end user's perspective. 2. Extension is a symbolic (quantity***price). When it recalculates, I need to send a CALCULATE event to another control in the window. Obviously, it recalculates if either price or extension for the row changes. How do I most easily capture the fact that this has occurred? Do I use the CHANGED event, and then check to see which column I am in to decide if EXTENSION has changed? Or, do I use the POSCHANGED event and see if price or quantity has changed. If the symbolic in the other control is dependent upon the columns in the edittable then I doubt you would need to send a CALCULATE event. Is this symbolic not recalculating on its own? If you are having trouble then I would recommend trapping the POSCHANGED event. 3. My last question leads to: how do I detect if a particular cell's value has changed? It seems what is needed is the equivalent of a GOTFOCUS and LOSTFOCUS on each cell, but we only have POSCHANGED, right? If I am in POSCHANGED, how the heck to I access the original value of the cell I just left? OI doesn't give you the easy of checking this like AREV did. Essentially you have to create your own technique. We use a user-defined property, @PREV_INVALUE, and compare the current INVALUE of the edittable. We use promoted events to automate this but you could simply put this into the edittable's GOTFOCUS/POSCHANGED/LOSTFOCUS events. At the end of the logic you would transfer the contents of INVALUE to @PREV_INVALUE. 4. What is the best way to have Edittable-Column-based logic remain valid if I decide to re-order the columns in the edittable? (That is, if column 3 is now quantity, and I need to act on that, but later on I insert a column ahead of it, for example.) Equates? [email protected] SRP Computer Solutions, Inc.
</QUOTE> —- === At 23 APR 2002 01:00PM David Kafka wrote: === <QUOTE>Don, 1. SELPOS sets or returns the position of the cursor (i.e. highlighted cell) that the user sees. ACCESSPOS sets or returns an internal position/pointer that does not necessarily correspond with what the user sees. You would use ACCESSPOS if you wanted the data in a specific cell (in conjunction with ACCESSDATA) without moving the cursor from the end user's perspective. Let me see if I understand this: the position returned or set by SELPOS is based on the visible cursor. The position set or returned by ACCESSPOS is separate and hidden. What is ACCESSPOS set to if you don't deliberately set it? Do you have to explicitly set it? What can change it aside from a SET_PROPERTY? And how does it then relate to CELLPOS? Does this mean that when you use CELLPOS you are also setting ACCESSPOS? 2. If the symbolic in the other control is dependent upon the columns in the edittable then I doubt you would need to send a CALCULATE event. Is this symbolic not recalculating on its own? If you are having trouble then I would recommend trapping the POSCHANGED event. No, the dependent symbolic is not recalculating dependably on its own–only if I send a CALCULATE event. (The dependent symoblic is outside the edit table, but dependent on 2 separate symbolics inside the edittable). Since POSCHANGED is for the edittable as a whole, and I only want to send the calculate event when either of two columns changes, I need, within the POSCHANGED event, to know that I have just left one of those two columns and that one of the values has changed. Further experimentation implies that I can save myself a bit of work by using the CHANGED event in the edittable: using the PREVSELPOS property I can tell which cell I have left, and since I am in the CHANGED event I know that that cell must have changed values. 3. OI doesn't give you the easy of checking this like AREV did. Essentially you have to create your own technique. We use a user-defined property, @PREV_INVALUE, and compare the current INVALUE of the edittable. We use promoted events to automate this but you could simply put this into the edittable's GOTFOCUS/POSCHANGED/LOSTFOCUS events. At the end of the logic you would transfer the contents of INVALUE to @PREV_INVALUE. When I first asked this question about simple controls, I was under the impression that I would need to trap an @PREV_VALUE on the GOTFOCUS event. I have since learned that on most controls that GOTFOCUS_VALUE seems to give me what I want. With the edittable, my first thought is to catch either the LIST or the ARRAY property on GOTFOCUS, as an @PREV_INVALUE, and then to maintain that array as cell values change within the edittable. The main logical issue is that you can stay in the edittable for a long time, so the GOTFOCUS information must be maintained internally. I was wondering if there was any internal property equivalent to GOTFOCUS_VALUE that could be used as you moved in and out of individual celss. 4. What is the best way to have Edittable-Column-based logic remain valid if I decide to re-order the columns in the edittable? (That is, if column 3 is now quantity, and I need to act on that, but later on I insert a column ahead of it, for example.) Equates? Well, yes, my first stab at this is to use an EQUATES INSERT. But, of course, that still means I need to maintain the EQUATES. I was wondering if there was any reasonably elegant programatic way of determining at runtime which column was which. That is, what I need to know is NOT whether column 1 has changed, but rather whether the "PRODUCT" column has changed. I would rather test the value of than . If I later rearrange the column sequence, I would love it if the code still worked without my having to change the equates and recompile. Thanks for all your help, Don. David </QUOTE> —- === At 24 APR 2002 10:18AM Oystein Reigem wrote: === <QUOTE>David, 4. If all your edit table columns are bound to database table fields, you can do <code> FieldName=Get_Property( CtrlEntID, "COLUMN" ) </code> to determine which table column (field) the ColNo'th column of edit table CtrlEntID is linked to. - Oystein - </QUOTE> —- === At 24 APR 2002 01:28PM David Kafka wrote: === <QUOTE>Oystein, Thanks. </QUOTE> View this thread on the Works forum...