[gtkada] Lists }:-<
hark sng-
passhark at hotmail.com
Sat Mar 17 23:49:55 CET 2001
The List_Remove function in testgtk has not helped me much but I have found
_a_ way to do it....this is for all those who also have asked or will ask
some time in the future
Here is some example code that on inspection should show you how. The
compelete program has 2 lsit source and destination (used for currency
conversion)
There is a '+1' to offset the index from 0 to 1
---------------------------------
PROCEDURE OK_Clicked_Handler (Object : ACCESS Gtk_Button_Record'Class) IS
-- Get the selected list items
--
SourceCurrency : Widget_List.Glist;
SourceCurrencyitem : Widget_List.GList;
DestinationCurrency : Widget_List.GList;
DestinationCurrencyitem : Widget_List.Glist;
SourceSelectedCurrency : Integer;
DestinationSelectedCurrency : Integer;
BEGIN
-- Get the selected currencies
--
-- Get the selected items in a data stucture
SourceCurrency := Get_Selection(Widget => Main_Window.Source_List);
DestinationCurrency := Get_Selection(Widget =>
Main_Window.Destination_List);
-- Extract the selected items
SourceCurrencyitem := Widget_List.First(List => SourceCurrency);
DestinationCurrencyitem := Widget_List.First(List =>
DestinationCurrency);
-- Get the selected item's index values
SourceSelectedCurrency := Integer(Widget_List.Index(List =>
Get_Children(Widget => Main_Window.Source_List),
Data => Widget_List.Get_Data(SourceCurrencyItem)) + 1);
DestinationSelectedCurrency := Integer(Widget_List.Index(List =>
Get_Children(Widget => Main_Window.Destination_List),
Data => Widget_List.Get_Data(DestinationCurrencyItem)) + 1);
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
More information about the gtkada
mailing list