Jump to content

WMC Ederson

uniGUI Subscriber
  • Posts

    2
  • Joined

  • Last visited

Posts posted by WMC Ederson

  1. On 9/22/2018 at 6:01 AM, Pep said:

    Hello,

    First of all, thanks to CastleSoft for these components.

    I noticed that the "TUniJToast" component does not work properly with the "loader" property. If you choose false, the loader keeps showing.

    To correct, I made these changes in the function TUniJToast.BuildJsonParams: string;

    I changed these line

    
       bstr := bstr + 'loader:' + BoolToStr(loader) +',';

    for this

    
       bstr := bstr + 'loader:' + LowerCase(BoolToStr(loader, true)) +',';

     

    Hey, I found some others issues on the code from jToast.

    There is what I changed (in uniJToast > BuildJsonParams):

    allowToastClose

    if allowToastClose then
      bstr := bstr + 'allowToastClose:true,'
    else
      bstr := bstr + 'allowToastClose:false,';

    stack

    if (stack) then
      bstr := bstr + 'stack:' + IntToStr(stackSize) +','
    else
      bstr := bstr + 'stack:false,';

    position

    bstr := bstr + 'position:' + '"' + StringReplace(GetPosition(pos), '_', '-', [rfReplaceAll]) + '",';

    loader (like Pep's post)

    if loader then begin
      bstr := bstr + 'loader:true,';
      bstr := bstr + 'loaderBg: ' + '"' + loaderBg + '",';
    end else
      bstr := bstr + 'loader:false,';

    With these changes the component worked perfectly.

    Here is all procedure code:

    function TUniJToast.BuildJsonParams: string;
    var bstr: string;
    begin
       bstr := '{';
       bstr := bstr + 'text:' + '"' + text + '",';
       bstr := bstr + 'heading:' + '"' + heading + '",';
       bstr := bstr + 'icon:'    + '"' + GetIconType(icon) + '",';
       bstr := bstr + 'showHideTransition:' + '"' + GetTransition(showHideTransition) + '",';
    
       if allowToastClose then
         bstr := bstr + 'allowToastClose:true,'
       else
         bstr := bstr + 'allowToastClose:false,';
    
       if hideAfter > 0 then
          bstr := bstr + 'hideAfter:' + IntToStr(hideAfter) + ',';
    
       if (stack) then
          bstr := bstr + 'stack:' + IntToStr(stackSize) +','
       else
          bstr := bstr + 'stack:false,';
    
       bstr := bstr + 'position:' + '"' + StringReplace(GetPosition(pos), '_', '-', [rfReplaceAll]) + '",';
       bstr := bstr + 'textAlign:' + '"' + GetTextAlign(textAlign)  + '",';
       if loader then begin
         bstr := bstr + 'loader:true,';
         bstr := bstr + 'loaderBg: ' + '"' + loaderBg + '",';
       end else
         bstr := bstr + 'loader:false,';
    
       // Add Callbacks here
       bstr := bstr + 'beforeShow: function() { ajaxRequest('+JSName+',"beforeShow",[]); },';
       bstr := bstr + 'afterShown: function() { ajaxRequest('+JSName+',"afterShown",[]); },';
       bstr := bstr + 'beforeHide: function() { ajaxRequest('+JSName+',"beforeHide",[]); },';
       bstr := bstr + 'afterHidden: function() { ajaxRequest('+JSName+',"afterHidden",[]); }';
       bstr := bstr + '}';
       result := bstr;
    end;

     

×
×
  • Create New...