Jump to content

Kast2k

uniGUI Subscriber
  • Posts

    55
  • Joined

  • Last visited

Posts posted by Kast2k

  1. Hello!

    There are AdoQuery (aq), Datasource(ds) and DbLookupcombobox (dbc) placed on frame. Also i have a variable integer (varInt=3) for locating data in dbc.

    aq have 1 parameter and returns 2 fields and configured as ds.Dataset=aq

    select
    idStatus,
    StatusName
    from tblStatuses
    where
    	idRelational = :idRelational

    dbc is configured like

    Listsource=ds

    ListField=StatusName

    KeyField=idStatus

     

    After setting the parameter (idRelational=3)

    aq.Parameters.ParamByName('idRelational').Value=varInt

    the dbc is refreshed like:

    procedure TUniMainModule.RefreshDBComboBox(dbc: TUniDBLookupComboBox);
    begin
      dbc.BeginUpdate;
      try
        try
          dbc.ListSource.DataSet.Close;
          dbc.ListSource.DataSet.Open;
        except
          on E: Exception do
            begin
              PostToLog('RefreshDBComboBox error='+e.Message);
            end;
          on E: EOleException do
            begin
              PostToLog('RefreshDBComboBox error='+e.Message);
            end;
        end;
      finally
        dbc.EndUpdate;
      end;
    end;

    After that i'm trying to locate data by this code:

    function TUniMainModule.LocateData(cb: TUniDBLookupComboBox;
      const AValue: Variant; const AFieldName: string): Boolean;
    var
      b:Boolean;
    begin
      b:=False;
      try
        if not VarIsNull(AValue) then
          begin
            if (VarIsNumeric(AValue) and (AValue<=0)) or (VarIsStr(AValue) and (AValue='')) then
              begin
                cb.KeyValue:=null;
                Exit;
              end;
            try
              b:=cb.ListSource.DataSet.Locate(AFieldName,AValue,[loCaseInsensitive]);
              if b then
                cb.KeyValue:=cb.ListSource.DataSet.FieldByName(cb.KeyField).Value
              else
                cb.KeyValue:=null;
            except
              on E: Exception do
                begin
                  UniSession.Log(Format('Error LocateData( %s, %s )= %s ',[AFieldName, VarToStr(AValue), e.Message]));
                end;
              on E: EOleException do
                begin
                  UniSession.Log(Format('Error LocateData( %s, %s )= %s ',[AFieldName, VarToStr(AValue), e.Message]));
                end;
            end;
          end
        else
          cb.KeyValue:=null;
      finally
        Result:=b;
      end;
    end;
                                                     
                                                     
    procedure TMyFrame.FindAndShowRowData;
    begin
    	if UniMainModule.LocateData(dbc,varInt,'idStatus') then
          begin
          end                                                 
    end;                                                 

    If i'm opening frame for first time then i can see that LocateData works OK and the only 1 row is showed by component.

    But if i executing this code (set parameter (3->4), refreshDBCombobox, locatedata) on opened frame again then component dbc shows nothing, but cb.ListSource.DataSet.Locate returns TRUE, needed row exists in list and i can select it manually.

    What am i doing wrong or is it DBLookupCombobox bug?

    Unigui 1.90.0.1528.

  2. Hello!

    There is TUniPageControl on Main form and few buttons.

    By pressing some button the needed Frame is created and placed on new tab on PageControl.

    On VCL application i can do PostMessage from frame with TabIndex f.e. and MainForm will free needed tab and frame on it.

    What is the best practice in UniGUI? I cant free the Tab from Frame placed on it.

    May be i need to execute some public procedure on Main form which will start a UniTimer and onTimer will free the Tab?

    Thank You.

  3. 20 minutes ago, stas said:

    Вы не можете отправить файл, пока его не попросили, работа с вебсервером ведётся в режиме вопрос ответ, потому и виснет 

    Вы меня видимо не совсем так поняли :) я привёл пример простейшего приложения по опросу БД по таймеру, которое у меня подвисает, хотя все Exceptions по работе с БД прописаны

  4. Особых затруднений нет, кроме того, сможет ли сервис (Server Module) создавать потоки и не приведет ли это к внезапной остановке приложения на пустом месте с отсутствием каких-либо ошибок, как уже бывало ранее (пример, на страничке находится разноцветный UniDBGrid, обновление данных по таймеру (3000 мс), компоненты FD в DataModule, никаких действий больше в программе нет. Скомпилирован в Windows Service - > может самопроивзольно зависнуть при просадке сети. При этом ни в Event Log, ни в логах приложения ни слова = просто висит и на него не зайти).

    Спасибо за комментарии, я примерно так и хотел реализовывать.

  5. Добрый день!

    Есть ЕХЕ файл на сервере, при его запуске с параметрами происходит формирование графического файла заданного формата.

    Вопрос:

    Как правильно реализовать на Unigui следующий процесс:

    1. Пользователь через UniFileUpload загружает документ на сервер

    2. Ссылка на данный документ транслируется в ServerModule и он в свою очередь создает, запускает и добавляет в ThreadList поток для обработки файла.

    Внутри потока формируется строка параметров обработки и выполняется EXE файл с ожиданием окончания обработки.

    Далее, получившийся файл копируется во временную папку Unigui и отправляется обратно пользователю для скачивания.

    Имеет ли такая идея право на жизнь или необходимо как-то по другому построить процесс взаимодействия? (ServerModule = singleton)

    Спасибо.

  6. Hi!

    There is CSS problem with TUniStringGrid in 6.5.3

     

    Later i was using this CSS for fitting all table cells on panel

    .SGGL .x-grid-table {
    height: 100%;
    width: 100%;
    }
    .SGGL .x-grid-cell-Inner {
    text-align: center !important;
    }
    .SGGL .x-grid-cell {
    vertical-align : middle !important;
    }
    function beforeInit(sender, config)
    {
    config.cls = "SGGL";
    }

    After update to 6.5.3 this CSS is not full workable.

    I tried different x-grid and panels parameters for repair, but no results

     

    Could you please help me to correct this CSS? Or may be somebody had the same trouble with new ExtJS.

     

    Thank You!

     

    I attached 2 pictures: normal situation and after 6.5.3.

    post-3740-0-59190900-1528184269_thumb.png

    post-3740-0-40936800-1528184282_thumb.png

  7. It is simplier that that.

     

    Old picture memory just not being released when you assign new picture. That's all.

     

    Just create large bitmap and you'll see it clearly.

    I understand the process :) I dont understand what is happening inside browser at this moment :(

  8. As temporary countermeasure i set Unitimer interval as 6000 (maximum production time available) and the result in Firefox-esr is about 10 hours, in Chrome - 6.5-7 hours.

     

    It always seems to be strange that this browsers are getting data, increasing used memory, cleaning memory. But at one time something is going wrong and free memory is decreasing critically without any garbage collection. Almost unknown situation.

     

    So sometimes i begin to think about using CrossVCL components, but the number (about 18) of current PC clients is pausing me.

  9. Dear colleagues,

     

    At the current time i'm developing a information software that will run on server and clients (raspberry).

    Architecture (very common):

    1. Server gets data from different sources and creating a bmp picture.

    2. Clients are connecting server, getting picture and show it on form.

     

    Problems:

    1. If i'm using UniCanvas then Chromium receives stack overflow after few hours (4-5). No free memory error.

    2. if i'm using UniImage then picture is blinking.

     

    Picture is get by client on UniTimer.

     

    Example:

    procedure TframTest.tmrFillCNTValuesTimer(Sender: TObject);
    var
      Loff:string;
      bmp:TBitmap;
    begin
      bmp:=TBitmap.Create;
      try
        UniMainModule.SelectedRoute.FillcnvCounter(bmp,FBMPCounter,Loff);
        try
              UniImage2.BeginUpdate;
              UniImage2.Picture.Graphic.Assign(bmp);
              UniImage2.EndUpdate;
    //          cnvCounter.BeginUpdate;
    //          cnvCounter.BitmapCanvas.StretchDraw(cnvCounter.BitmapCanvas.ClipRect,bmp);
    //          cnvCounter.EndUpdate;
            end;
    
          pnLineOffValue.Caption:=Loff;
        except
          on e:Exception do
            PostToLog('Cant find route '+UniMainModule.idRoute);
    
        end;
      finally
        bmp.Free;
      end;
    

    May be i'm doing something wrong?

    How can i receive picture from server without blinking or without memory overflow?

     

    PS. I read that chromium have a garbage collector bug with Canvas.

     

    Thank You.

  10. Dear colleagues,

     

    I placed label on panel and on frame resize i'm sending ajaxevent to panel and server calculates label font size based on panel width and height.

      if EventName='updatePNRouteSize' then
        begin
          a:=Params.Text;
          w:=StrToIntDef(Params.Values['w'],100);
          h:=StrToIntDef(Params.Values['h'],100);
    
          lblRouteName.Font.Size:=CalcElementFontSize(lblRouteName.Caption,w,h div 4); //OK
        end;
    

    After that i'm trying to place label at the top on the panel.

    function resize(sender, width, height, oldWidth, oldHeight, eOpts)
    {
      console.log('resize lbl'); 
      console.log(frmTest.pnRoute.getWidth()); //panel width (480)
      console.log((frmTest.pnRoute.getWidth()/2)); //half of panel width (240)
      console.log(frmTest.lblRouteName.getWidth()); //label width (130)
      console.log((frmTest.lblRouteName.getWidth()/2)); //half of label width (65)
      console.log((frmTest.pnRoute.getWidth()/2)-(frmTest.lblRouteName.getWidth()/2)); //label new X coord (175)
                            
      frmTest.lblRouteName.setX((frmTest.pnRoute.getWidth()/2)-
                                (frmTest.lblRouteName.getWidth()/2));                              
    }
    

    In browser i saw strange things:

    1. In console it shows that calculations are correct

    2. But after frame show the label is placed not in panel center.

    3. If i press F12 in browser then the label is placed as it was programmed. After console close the label position doesnt change and shows as needed.

     

    Could you please show me my errors? What i'm missing?

     

    Thank You.

     

    P.S. Of course i can replace label with panel and get the result but because i want to learn more in Unigui and Sencha so i'm trying so.

  11. Hi,

     

    The the width & Height are the same as server side, you may pass them from the client-side to server-side and after that do your drawing, you can use the Delphi debugger and the browser console to see the difference of the size.

     

    And don't use 'alClient' with layouts. 

    Thank You for reply.

    I removed alClient, set Height and Width of TUnicanvas to 100% but still no results.

     

    In browser console i see that data:

    <canvas id="O2A_canvas" width="481px" height="233px">Your browser does not support <canvas> element.</canvas></canvas>

     

    Could you please explain what is going wrong in my DFM?

     

    Thank You.

     

    P.S. Firefox 58, IE 11

     

    P.P.S Temporary i fixed the error by setting manually canvas Width and Height in UniFrameCreate procedure, but i think that this is not good decision.

×
×
  • Create New...