Jump to content

andyhill

uniGUI Subscriber
  • Posts

    1261
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by andyhill

  1. Thanks, but as mentioned above, I want to use Desktop Forms for both Login and New Accounts on both platforms, however when it comes to other forms I would want to check which platform and call either Desktop or Mobile forms accordingly (with mobile I will want to check for SmartPhone or Tablet).

     

    So back to my last question, how can uniGUI tell me in code to show fmPage (Mobile) instead of fPage (Desktop) after they have successfully logged in when I would normally execute fPage.ShowModal ?

     

    I would need to know in advance whether to execute fPage.ShowModal -or- fmPage.ShowModal.

  2. I have two UniForms (fMain / fNewAccount): fMain via a ButtonClick shows fNewAccount.ShowModal which via a ButtonClick sends an email (this takes about 10 seconds) then fNewAccount closes and returns to fMain.

     

    I want to Disable the fNewAccount form preventing closing (in Delphi this disables all components on the form preventing the [X] and Cancel button from working) till my email has been sent. 

  3. Windows OS (server and desktop) require applications to use certain file locations, these can change from version to version, user to user (user has moved locations) etc.

     

    GetSystemPath($0023); // COMMON_APPDATA

     

    GetSystemPath($001A); // APPDATA

     

    GetSystemPath($0005); // CSIDL_PERSONAL

     

    My function GetSystemPath fetches these.

     

    I need my function GetSystemPath to work with uniGUI.

  4. I use a function to fetch Special Folder Locations that requires a handle, UniServerModule.Handle fails - please advise - thanks.  

     

     
    function TUniServerModule.GetSystemPath(Folder: Integer): String;
    var
      PIDL: PItemIDList;
      Path: PWideChar;
      AMalloc: IMalloc;
    begin
      Path:= StrAlloc(255); 
      SHGetSpecialFolderLocation(UniServerModule.Handle, Folder, PIDL);
      if SHGetPathFromIDList(PIDL, Path) then Result:= Path;
      SHGetMalloc(AMalloc);
      AMalloc.Free(PIDL);
      StrDispose(Path);
    end;
     
  5. I have a UniForm (UniForm2) that I am trying to send an AjaxEvent to update my ProgressBar (pg).

     

    The Form's AjaxEvent code is firing on: active, move, resize etc. as expected.

     

    It will not fire on my custom EventName 'update' sent via my UpdateJobProgress procedure, please advise how to resolve - thanks in advance.

     

     


    procedure TJobThread.Execute; // This will be extended when the basics work

    begin

      Progress:= 0;

      while not Terminated and (Progress < 100) do begin

        Inc(Progress);

        Sleep(50);

      end;

    end;

     


    function TUniForm2.DoSomething(): Boolean;

     

    ...

     


      //

      if Assigned(job) then begin

        if not (job.Finished or job.Terminated) then begin

          job.Terminate;

        end;

        job.Free;

      end;

      //

      job:= TJobThread.Create;

      job.FreeOnTerminate:= False;

      UniSession.AddJS('UniForm2.pg.updateProgress(0.0, ''Running...'', false);');

      UpdateJobProgress;

     

    ...

     

      BUSY WORKING HERE

    ...


     

    end;

     

    procedure TUniForm2.AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);

    begin

      if EventName = 'update' then begin

        MessageDlg(EventName, mtWarning, [mbOK]);

        UniSession.AddJS(Format('UniForm2.pg.updateProgress(%d/%d, ''Running...'', true);', [job.Progress, 100]));

        //

        if not (job.Finished or job.Terminated) then begin

          UpdateJobProgress;

        end else begin

          if job.Progress = 100 then begin

            UniSession.AddJS('UniForm2.pg.updateProgress(1.0, ''Done'', true);');

          end else begin

            UniSession.AddJS(Format('UniForm2.pg.updateProgress(%d/%d, ''Stopped by user'', true);', [job.Progress, 100]));

          end;

        end;

        //

      end;

    end;

     

    procedure TUniForm2.UpdateJobProgress;

    begin

      UniSession.AddJS('setTimeout(function() { ajaxRequest(UniForm2.form, ''update'', []) }, 200)');

    end;

     

×
×
  • Create New...