Update list entry
Update list entry
I'm just having a play at creating a simple list maintenance function and I'm wondering how do I control things so that Upd_entry doesn't update the last list item I hovered over, but the one I double clicked and wrote the details out to edit fields for the user to change? I want to sort of "lock" the currently selected list entry to just that one that was selected with a double click
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Update list entry
You need to do a GET_ENTRY to ensure that the list CurrentItem is assigned to the correct item in the list. You can also use LOC_ENTRY which has the additional option of not returning the field values.
Something like the following
Something like the following
Code: Select all
Mthroutine Name(Update)
Get_Entry Number(#List.FocusItem.Entry) From_List(#List)
* Assign variables
...
Upd_entry In_list(#List)
Re: Update list entry
Thanks. That worked a treat.
So the Get_Entry Number(FocusItem.Entry) sets the CurrentItem to be what? The line I last Clicked or Double clicked?
And normally CurrentItem would just be what I hovered over long enough for the list entry to be highlighted?
And is there a way I could restrict it to only being lines I double clicked, rather than ones I clicked?
So the Get_Entry Number(FocusItem.Entry) sets the CurrentItem to be what? The line I last Clicked or Double clicked?
And normally CurrentItem would just be what I hovered over long enough for the list entry to be highlighted?
And is there a way I could restrict it to only being lines I double clicked, rather than ones I clicked?
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Update list entry
CurrentItem (http://docs.lansa.com/14/en/lansa016/PR ... NTITEM.htm) is a programming concept and is the item that was last used IN ANY WAY. That means, a Click, DoubleClick, MouseOver, processing in a SELECTLIST, GET_ENTRY etc. etc.... ANYTHING.
You cannot restrict CurrentItem processing. It is utterly fundamental to RDMLX. It ensures that when there is any kind of interaction with a list control, the related variable values are up to date.
FocusItem (http://docs.lansa.com/14/en/lansa016/PR ... usITEM.htm) is the item that will respond to user input of some sort. This is typically the last item touched by the user either through a click or keyboard manipulation with the arrow keys.
Get_Entry Number(FocusItem.Entry) will set the CurrentItem to be the same one as the FocusItem, which in your case is the one you last clicked.
I'm not sure I understand your last question about limiting to DoubleClick. What problem are you trying to resolve?
You cannot restrict CurrentItem processing. It is utterly fundamental to RDMLX. It ensures that when there is any kind of interaction with a list control, the related variable values are up to date.
FocusItem (http://docs.lansa.com/14/en/lansa016/PR ... usITEM.htm) is the item that will respond to user input of some sort. This is typically the last item touched by the user either through a click or keyboard manipulation with the arrow keys.
Get_Entry Number(FocusItem.Entry) will set the CurrentItem to be the same one as the FocusItem, which in your case is the one you last clicked.
I'm not sure I understand your last question about limiting to DoubleClick. What problem are you trying to resolve?
Re: Update list entry
I made the selection of Items from the list to be those that were Double Clicked.
i.e. if you click a list entry once, it is not selected and displayed below the list in edit fields. But if you double click it, it will be.
Then I wanted to allow the user to change the values and hit an Update button and THAT entry that was doubled clicked would be the one that was updated.
The way it works now, I can double click and edit an item but if. before I click the Update button, I happen to click another entry in the list, THAT entry will be the one updated with the values I've updated or have on display below the list.
i.e. if you click a list entry once, it is not selected and displayed below the list in edit fields. But if you double click it, it will be.
Then I wanted to allow the user to change the values and hit an Update button and THAT entry that was doubled clicked would be the one that was updated.
The way it works now, I can double click and edit an item but if. before I click the Update button, I happen to click another entry in the list, THAT entry will be the one updated with the values I've updated or have on display below the list.
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Update list entry
Given that you're using DoubleClick, you can't rely on the FocusItem.
The simplest solution is to use an identifier of some sort and to find the item when it's time to update.
The simplest solution is to use an identifier of some sort and to find the item when it's time to update.
Re: Update list entry
Thanks. I thought that might be the case and that won't be too hard.
But I may alter my methodology to take advantage of what LANSA does natively anyway.
This was just a "I've learned a bit from the Tuts so lets try and make something from scratch" exercise.
I was very happy to see how easily I could get some data out to a webpage and updated both on the screen and back to file.
But I may alter my methodology to take advantage of what LANSA does natively anyway.
This was just a "I've learned a bit from the Tuts so lets try and make something from scratch" exercise.
I was very happy to see how easily I could get some data out to a webpage and updated both on the screen and back to file.