Hi all Gnoga Users!
The current implementation for a selectmenu using jquery ui supports a workflow
where one first creates the selectmenu, and then populates it with options and
in the final step call Make_Select_Menu to apply the jquery ui style change. It
is not possible to receive notifications when a user selects an option (at
least I could not receive notifications when using a On_Change_Handler nor
On_Click_Handler). Also updating the selectmenu with new options or removing
previously added ones is not reflected in the browser. I suggest adding the
following procedures to the
Gnoga.Gui.Plugin.jQueryUI.Widget package to fix these limitations (the code is
not perfect but gets the job done):
-- Call this procedure to receive notifications when selected option changes.
procedure Make_Select_Menu
(Element : in out Gnoga.Gui.Element.Form.Selection_Type'Class;
On_Changed_Handler : in Base.Action_Event);
-- Assuming Make_Select_Menu already has already been called on the select
menu.
-- If the options are changed afterward, call this procedure to make
-- changes visible in the browser.
procedure Refresh_Select_Menu
(Element : in out Gnoga.Gui.Element.Form.Selection_Type'Class);
-- Assuming Make_Select_Menu already has already been called on the select
menu.
-- Deletes all elements in a select menu.
-- To make the change visible in the browser call Refresh_Select_Menu.
-- The "normal" usage is to remove all options in the select menu and
-- then populate it again with options and then call Refresh_Select_Menu.
procedure Clear_Select_Menu
(Element : in out Gnoga.Gui.Element.Form.Selection_Type'Class);
procedure Make_Select_Menu
(Element : in out Gnoga.Gui.Element.Form.Selection_Type'Class;
On_Changed_Handler : in Base.Action_Event)
is
US : constant String := Element.Unique_ID'Img;
Unique_Id : constant String := US (US'First + 1 .. US'Last);
Mouse_Event_Script : constant String := "";
begin
Element.On_Change_Handler (On_Changed_Handler);
Element.jQuery_Execute ("selectmenu({ change: function( e, data ){
ws.send (""" & Gnoga.Escape_Quotes (Unique_ID & "|change|") & """); } })");
end Make_Select_Menu;
procedure Refresh_Select_Menu
(Element : in out Gnoga.Gui.Element.Form.Selection_Type'Class)
is
begin
Element.jQuery_Execute ("selectmenu('refresh')");
end Refresh_Select_Menu;
procedure Clear_Select_Menu
(Element : in out Gnoga.Gui.Element.Form.Selection_Type'Class)
is
begin
Element.jQuery_Execute ("find('option').remove().end();");
end Clear_Select_Menu;
I've tried to be true to the Ada code style applied to the Gnoga library. What
do you think?
Best regards,
Joakim Strandberg
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Gnoga-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gnoga-list