Edit tables and updating symbolics (OpenInsight Specific)
At 12 APR 2000 10:30:59AM Oystein Reigem wrote:
Here's something I never learned to do properly: Updating symbolics in connection with edit tables.
Now I have a data aware edit table ET with fields A, B, AS and BS. AS and BS are symbolics, calculated from A and B. In the same form I have an edit field with a symbolic NUM=the number of data rows in ET. (So NUM is also calculated from A and B.)
Now I have this handler that deletes a row of data in ET, with a Send_Event(@Window:".ET", "DELETE", RowNo). What is the proper way of getting all the symbolics updated? Possibly misinterpreting an ancient posting of Don Bakke's I've tried having a DELETEROW event on ET that sends a CALCULATE event to each of the symbolics:
Send_Event(@Window:".ET", "CALCULATE", 3) /* i.e, the AS column in ET */
Send_Event(@Window:".ET", "CALCULATE", 4) /* i.e, the BS column in ET */
Send_Event(@Window:".NUM", "CALCULATE")
This doesn't work, however.
Help?
- Oystein -
At 12 APR 2000 12:18PM Don Bakke wrote:
Oystein,
The reason it doesn't work is because a Send_Message("DELETE") won't trigger the DELETEROW event. This is something I believe should be fixed by RTI but in the meantime you need to put the Send_Event(CtrlName, "CALCULATE", ColNum) commands in the same handler that deletes the edittable rows.
At 12 APR 2000 01:37PM Oystein Reigem wrote:
Don,
Thanks. You're my man. I'll try first thing in the morning (not at work now).
In the meantime - do I need to send a CALCULATE for that symbolic edit line as well? Or is it enough with the symbolics in the edit table?
Btw - I simplified when I said the edit table had two symbolics. It's closer to a dozen. Do I really need one CALCULATE for each of them?
- Oystein -
At 12 APR 2000 02:33PM Don Bakke wrote:
Oystein,
You will probably have to calculate the editline symbolic as well. You will also have to calculate all dozen symbolic columns.
At 12 APR 2000 02:34PM Don Miller - C3 Inc. wrote:
Oystein ..
I do a lot of this in one app. I have a push-button that is used to delete the rows in an edittable (using selpos to determine which row to delete). I do this by decomposing the dbtable and doing a delete in R/BASIC and then re-writing the edittable with the results. I make sure that the DEFPROP of the table is reset with the new data.
Finally, I make the LOSTFOCUS event fire on the control. If there are other symbolics in the form which depend on it, I send a calculate to each of these as well.
Essentially, I use the same logic to Add or Change the data as well. The only difference is that these use a dialog-box to get and validate the data as well. I then update the table by re-writing it and sending the same events along. I can post you a code sample if you need it (although I doubt that you would).
Don Miller
C3 Inc.
At 13 APR 2000 08:11AM Oystein Reigem wrote:
Don M,
I believe I got at least some of my code to work now. But not everything. Very kind of you to offer me that code sample. Please post or mail. In the meantime I might try with a simplified version of my form.
- Oystein -
Øystein Reigem,
Humanities Information Technologies,
Allégt 27,
N-5007 Bergen,
Norway.
Tel: +47 55 58 32 42.
Fax: +47 55 58 94 70.
Home tel/fax: +47 56 14 06 11.
At 13 APR 2000 09:30AM Oystein Reigem wrote:
Don B (and Don M),
The reason it doesn't work is because a Send_Message("DELETE") won't trigger the DELETEROW event. This is something I believe should be fixed by RTI but in the meantime you need to put the Send_Event(CtrlName, "CALCULATE", ColNum) commands in the same handler that deletes the edittable rows.
When I use Send_Message DELETE there is an immediate visible result. One line of data disappears from view. The next lines roll upwards.
But the change is not "data aware". If I close the window there's no save warning.
(Also strange things happen if I do a subsequent Send_Event CALCULATE on the symbolic edit line that depends on data in the edit table. Then some of the values for the deleted line's symbolics reappear in the edit table.)
So can you help me get DELETE to work?
Or should I do everything with DEFPROP? (Even if it means getting and setting the whole content when I just want to delete a row?)
- Oystein -
At 17 APR 2000 12:26PM Don Miller - C3 Inc. wrote:
Oystein .. Sorry for the delay. I noticed that you had posted me ar request for some code. Sent via E-Mail to you: ROUTINES.TXT which was cut from several places. Hope they help.
Don
At 18 APR 2000 04:09AM Oystein Reigem wrote:
Don M,
Thanks for the code. It reminded me about the "REDRAW" property, which I think will come in handy. But it couldn't help with my main (and only real remaining) problem…
both,
…which is getting Send_Message(…,"DELETE",…) to work with an edit table. I use it to delete a line in a data aware edit table, but afterwards it seems to be in an inconsistent state, which shows when I try to recalculate symbolics. Don B - are you sure you ever got Send_Message(…,"DELETE",…) to work with data aware edit tables and symbolics?
- Oystein -
At 18 APR 2000 09:16AM Don Bakke wrote:
Oystein,
I looked at one of our applications and discovered that we call a common process whenever a Send_Message(Ctrl, "DELETE") or Send_Message(Ctrl, "INSERT") is used. Here is the code:
[list]
Calculate_Edittable_Symbolics: /* Whenever the data in an edittable row is shifted, the symbolic fields associated need to be recalculated to synchronize the display */ Set_Property(Control, "REDRAW", No$) ; * Prevent the flicker effect /* Apparantly the Send_Message("INSERT") and the Send_Message("DELETE") will update the DEFPROP property of an edittable, however, it won't update the RECORD property of the form. This is a problem because many routines and symbolic fields depend on the RECORD property. Therefore, the DEFPROP property must be retrieved and then re-applied to the edittable to update the RECORD property. */ DefProp=Get_Property(Control, "DEFPROP") rv=Set_Property(Control, "DEFPROP", DefProp) Pos=Get_Property(Control, "POS") ; * Get the known field positions of the edittable. This is @SVM delimited NumCols=Count(Pos, @SVM) + (Pos NE "") For Loop=1 to NumCols Col=Field(Pos, @SVM, Loop) If Col EQ "" then /* A null value means this a symbolic field is in this column. It could also mean this is a non-databound column but it doesn't matter for this process */ Set_Property(Control, "DEFPROP", "", Loop:@FM:0) ; * Clear the column of existing values Send_Event(Control, "CALCULATE", Loop) ; * Recalculate the symbolic field end Next Loop Set_Property(Control, "REDRAW", Yes$) ; * Show the changes return[/list]
At 18 APR 2000 10:16AM Oystein Reigem wrote:
Don,
You're a gem! Du er knuppen på dasslokket!
- Oystein -
Øystein Reigem,
Humanities Information Technologies,
Allégt 27,
N-5007 Bergen,
Norway.
Tel: +47 55 58 32 42.
Fax: +47 55 58 94 70.
Home tel/fax: +47 56 14 06 11.
At 18 APR 2000 01:06PM Don Bakke wrote:
Du er knuppen på dasslokket!
I distinctly recall there is no swearing on this website.
At 18 APR 2000 06:48PM Oystein Reigem wrote:
Don,
I wouldn't call it swearing. Vulgar, perhaps, but humorous, and without any hint of malice. It's a local expression from before we had water closets. "Knuppen på dasslokket" is literally the handle or knob ("knapp" or "knupp") of the loo-lid ("dasslokk"). A very important little thing, without which the lid would be akward to handle. Used about a person it's high praise indeed.
![]()
- Oystein -
At 03 MAY 2002 04:35PM David Kafka wrote:
Just wanted to let you know, after an hour of aggravation I searched the postings, found this re INSERT/DELETE, used it, problem solved.
Thanks.
David