Hi,
I have a treegadget generated from a database the fields of the database are stored in a map with the id of the
record as key. This id is also stored as ItemData().
If I 'add' a new member in the tree I generate a new ID with a very large number.
Later if the user decided to save his new tree I update the database or I insert a new record.
But the new record gets an automatic ID by the database.
I have to change the ItemData (no problem) and I have to change the MapKey() (not possible)
So I have to copy the MapElement (CopyMapElemnt() not available) and I have to delete the old one.
It would be much easier if ChangeMapKey() is available.
Btw. I changed now everything to a LinkedList() and store the address of the element as ItemData()
Than I can use ChangeCurrentElement()
That's independent from the ID of the record.
Bernd
ChangeMapKey()
Re: ChangeMapKey()
So instead of this:
you want to be able to do this?
Code: Select all
;change key on old record to new value
If FindMapElement(treestuff.d_record(), "123")
temp.d_record = treestuff()
DeleteMapElement(treestuff())
treestuff("987654321") = temp
EndIf
Code: Select all
;change key on old record to new value
If FindMapElement(treestuff.d_record(), "123")
ChangeMapKey(treestuff(), "987654321")
EndIf