Browse Source

* Use correct properties for OK button, and close on cancel button click

Michaël Van Canneyt 1 year ago
parent
commit
54b6dbb3c8
1 changed files with 5 additions and 1 deletions
  1. 5 1
      packages/bulma/src/bulmawidgets.pas

+ 5 - 1
packages/bulma/src/bulmawidgets.pas

@@ -108,6 +108,7 @@ Type
     Procedure Hide;
     Procedure Hide;
     Function HTMLTag : String; override;
     Function HTMLTag : String; override;
     Property Showing : Boolean Read FShowing;
     Property Showing : Boolean Read FShowing;
+    Property Reference;
     // Id of the modal toplevel element. If not set, the first child is used.
     // Id of the modal toplevel element. If not set, the first child is used.
   Published
   Published
     Property ParentID;
     Property ParentID;
@@ -472,7 +473,10 @@ begin
   NList:=Element.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete');
   NList:=Element.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete');
   for I:=0 to Nlist.length-1 do
   for I:=0 to Nlist.length-1 do
     TJSHTMLElement(NList.Nodes[i]).addEventListener('click',@HideClick);
     TJSHTMLElement(NList.Nodes[i]).addEventListener('click',@HideClick);
-  E:=References.FindElementByName('OK');
+  E:=References.FindElementByName(OKButtonName);
+  if (E<>Nil) then
+    E.addEventListener('click',@HideClick);
+  E:=References.FindElementByName(CancelButtonName);
   if (E<>Nil) then
   if (E<>Nil) then
     E.addEventListener('click',@HideClick);
     E.addEventListener('click',@HideClick);
   for I:=0 to References.Count-1 do
   for I:=0 to References.Count-1 do