Jump to content

Roberto Nicchi

uniGUI Subscriber
  • Posts

    226
  • Joined

  • Last visited

Posts posted by Roberto Nicchi

  1. On 6/1/2021 at 6:46 PM, Mehmet Emin said:

    Since you are using CreateAnonymousThread and calling TUniServerModule.myproc, TUniServerModule has already same named property "Terminated". So I think you would better have your thread class and check the threads "Terminated" property within. Then you be able to exit the while loop. Also after FmyThread.Terminate; you can call thread waitfor better cleanup.

    Got it, thanks !

    Roberto

  2. I have first created my application as standalone project.

    Now i have created the service application project.

    The service start and works fine but when i try to stop it, it doesn't respond and can't be stopped.

    The problem seems related to a thread that is created in the servermodule. If i remove this thread, the service can be stopped with no problem.

     

    Probably i'm not doing it correcty. I'm going to describe how it work:

     

    In the server module oncreate event i have used a code like this:

      FmyThread:=Tthread.CreateAnonymousThread(myproc);
      FmyThread.Start;

      FmyThread is defined in the private section of the server module.

     

    In the server module onbeforeshutdown event i have placed code to terminate the thread

      FmyThread.Terminate;

     

    The myproc procedure is like this

    procedure TUniServerModule.myproc;
    var
      Start,Finish:Tdatetime;
    const
      SecBetweenRuns = 60;
    begin
      Start:=now;
      while not Terminated do
      begin
        Finish:=now;
        if SecondsBetween(Start,Finish)>SecBetweenRuns then
        begin
           // Do something, the code execution is fast

          start:=Finish;
        end;

        sleep(1000);
      end;
    end;

  3. Ok i have the solution. See below. Let me know if there's another (better/faster) solution.

    In the button have defined the JS event click (in Extevents)

     

    function click(sender, e, eOpts)
    {
      if (confirm("Confermation request")==true)
        ajaxRequest(sender, '_doit', []);  
    }

     

    in the button have definied the onajaxevent event

     

      if EventName = '_doit' then
      begin
        modalresult:=mrOk;
      end;
     

  4. 10 minutes ago, Roberto Nicchi said:

    Ok, only now i have realized that there's a showmask property in the Tunibutton :)

    It works fine BUT, if in the button onclick event a messagedlg method is executed, the mask is not visualized. Is it WAD ?

    thanks

    I was folgorated by an idea. Maybe I have to make the request for confirmation with JS code ? If this is correct could anyone tell me how? Unfortunately my knowledge of JS is zero.

  5. Hayri, 

    I'm sorry, but it isn't the correct solution for me.

    I need the same visualization (that is, multiple pages if records are more than x), but without slidebar.

    After that, I add 4 buttons (next, previous,first,last page) for move between pages (to replace the slidebar)

  6. 20 minutes ago, Roberto Nicchi said:

    Ok, thanks.

    Roberto

    BUT :) if in the button that close the form i want a confirmation (see below), again there's the same problem. Is there a workaround for this ?

     

     

      if messagedlg('Confirm ?',mtConfirmation,[mbyes,mbno])=mrYes then
      begin

        ShowMask('Please wait ...');

        UniSession.Synchronize;


        modalresult:=mrOk;
      end;

     

  7. I have the exception "ProcessEventQueue(): Worker is not assigned." when the statement "UniSession.Synchronize" is executed in the code below.

    Is my code wrong ?

    thanks

     

    procedure Tmyframe.create_report;

    var
      dest:Tdest_report_frm;
    begin
        dest:=Tdest_report_frm.Create(uniGUIApplication.UniApplication);

        dest.showmodal(procedure(sender:Tcomponent; res:integer)
                       begin
                         if res=mrOk then
                         begin
                           ShowMask('Please wait ...');
                           UniSession.Synchronize; <--- EXCEPTION HERE
                           try
                             CreateTheReport;
                           finally
                             HideMask;
                             UniSession.Synchronize;
                           end;
                         end;
                       end
                      );

  8. Mehmet,

    your solution work! thanks a lot!

    My implementation:

    Quote

    private 

    var columnIDX,recordIDX:integer;

    tunidbgrid->clientevents->extevents->childdoubletap

    function childdoubletap(sender, location, eOpts)

      ajaxRequest(sender,'_doubleclick',["colidx=" +location.columnIndex, "rowidx="+location.recordindex]);
    }

    tunidbgrid->events->onAjaxEvent

      if EventName = '_doubleclick' then
      begin     
         columnIDX:= Params['colidx'].AsInteger;

          recordIDX:= Params['rowidx'].AsInteger;

      end;

    tunidbgrid->events->ondblclick

       if columnIDX=0 then

       begin

           //do something

       end;

     

     

     

     

  9. Regarding this problem i have created a support ticket but maybe somone else here can have a solution to the problem.

    It happens that the tab stop sequence is not correct when cycling with TAB (and SHIRT-TAB) between components. My application is made of a main form and frames, that opened inside the main form.

    I have attached to this message a self explained example that shows the problem.

    thanks

    DemoApp.zip

  10. What i need is to select the rows of a grid depending on some condition. The condition in this particular case is the value of a field; if the field has some value the record must be selected, otherwise not selected. This task must be executed after the grid has been loaded so i guess the right place where to place the code is in the OnAfterLoad event of the grid.

    Now i have the code to select or deselect all the rows but i have no idea how to select/unselect rows with a condition.

    Possible ?

    thanks

  11. On 10/30/2018 at 1:48 PM, Sherzod said:

    Maybe you should try this approach for now:

    1.

    
      
      YourGrid.JSInterface.JSAssign('needToSelectAll', [True]); //<---------
      liste.SQL.Clear;
      liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR  = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc ');
      liste.Open;

    2.

    YourGrid -> ClientEvents -> ExtEvents -> function store.load // or use the OnAfterLoad event of your Grid with some conditions

    
    function store.load(sender, records, successful, operation, eOpts)
    {
        if (sender.grid.needToSelectAll) {
            Ext.defer(function () {
                sender.grid.getSelectionModel().selectAll()
            }, 100);
        }
    }

     

    I'm trying this thing but sincerly i don't understand in what ext event i have to place the store.load function.

    I'm new to JS and UNIGUI

    I have tryed also to place the code UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); in the onafterload event of the grid but it has no effect. If i use the same code in a popup menu works fine.

    thanks

  12. My unigui application creates Tuniframe inside Tunitabsheet

    At the end of the process the INIT method is executed.

    The INIT method defined into the frame should move the focus to the desired component (setfocus). Anyway it doesn't work. this focus is somewhere (don't know where) and not in the correct component. I'm doing something wrong ?

    thanks  

     

    var
      ts:TUniTabSheet;
      idx: Integer;
      frame:Tstandard_frame;
    begin
      ts:=TUniTabSheet.Create(self);
      ts.Closable:=true;
      ts.PageControl:=pc;


      ts.Caption:='The frame';
      frame:=Taframe.Create(ts);
     

      frame.Parent:=ts;
      frame.Align:=alClient;
      frame.Show;


      pc.ActivePageIndex:=ts.PageIndex;

      frame.Init; // THIS METHOD SHOULD MOVE THE FOCUS EXECUTING THE SETFOCUS METHOD OF THE DESIRED CONTROL (SEE BELOW)
    end;

    .......

    procedure Taframe.init;override;

    .....

    procedure Taframe.init;
    begin
      acontrol.SetFocus; //  I'm sure this method is executed because i have placed here a showmessage
    end;

×
×
  • Create New...