_Y_ Posted April 21, 2015 Report Share Posted April 21, 2015 (edited) UI has an array. A new element can be added initialising one more element at the end or using menu "Insert element before". Both methods launch user event "Value Change". Is any way to see index of newly added element? My guesses are limited to watching position of mouse clicks but there is no fun is such a solution. Edited April 21, 2015 by _Y_ Quote Link to comment
ensegre Posted April 21, 2015 Report Share Posted April 21, 2015 (edited) What I normally do is to compare Old and New Value and look for the first nonequal element. If the new element is added at the end of the existing, off the head the boolean array will be short as the Old, but the increased length will asess the change in the last element. Edited April 21, 2015 by ensegre Quote Link to comment
_Y_ Posted April 21, 2015 Author Report Share Posted April 21, 2015 look for the first nonequal element. Unforttunalely, it does not work if a new element is iserted near an old element and both have default value. The simplest example is inserting in Boolean array where all elements are False. The method will say that the element is added at the end independently on the actual insertion position. Quote Link to comment
ensegre Posted April 21, 2015 Report Share Posted April 21, 2015 Right. But then one could argue, is it really important to evidence where the mouse has been clicked, or just how the resulting array differs at all? One workaround I could think (maybe), is the following: make an array of clusters, [ordinal,your_content], where "ordinal" is a flag, for example an integer which defaults to -1 and is set to the element number by the Value Change event. In the GUI you could hide "ordinal" if it falls in the way. Then finding the insertion translates into finding the first -1 in New Value, finding a deletion means finding a jump of 2. Quote Link to comment
Popular Post jcarmody Posted April 21, 2015 Popular Post Report Share Posted April 21, 2015 This uses Array Point to RowCol (from the Code Repository.) This is the next Event case. This takes almost no work, which may make up for it not being exactly what you want... 3 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.