Jump to content

JDDEV

uniGUI Subscriber
  • Posts

    73
  • Joined

  • Last visited

Posts posted by JDDEV

  1. Hi,

    I find a solution :

    I use UniURLFrame and i read a HTML file with this line :

    <input id="testBtn" value="saa1" type="button" onclick="top.ajaxRequest(top.MainForm., '_test', [])">

    When i click on "TestBtn" the UniFormAjaxEvent procedure show me "Test" ;)

    Best regards

    • Like 1
  2. I do the testcase with the GridCellStyle demo project.

    procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol,
      ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
    begin
      if ACol = 1 then begin
        //Attribs.Style.Cls:= 'myShadowStyle'; // style is defined in file "files/mycss.css"
        //Attribs.Style.Style := 'border: 5px solid green; font: red'   // define a style directly
        Attribs.Font.Color:=clYellow;
        Attribs.Font.Style:=[fsItalic];
        Attribs.Color:=clRed;
        Attribs.Style.Padding := '5px';
      end else if ACol = 2 then
        Attribs.Style.Padding := '0px';    // force image to fit in the cell
    end;

     

  3. Hi all,

    I am trying to sort columns on a UniDBGrid.

    To initialize my TFDMemTable (cds_Articles) i do :

        with cds_Articles do begin
          Indexes.Clear;
          for I := 0 to FieldCount-1 do begin
            IndexnameAsc := Fields.FieldName+'_index_asc';
            IndexnameDes := Fields.FieldName+'_index_des';
            with Indexes.Add do begin
              Name := IndexnameAsc;
              Fields := cds_Articles.Fields.FieldName+':A';
              Active := True;
            end;
            with Indexes.Add do begin
              Name := IndexnameDes;
              Fields := cds_Articles.Fields.FieldName+':D';
              Active := True;
            end;
          end;
        end;


    On DBGRidColumnSort event i do :

      UniMainModule.SortColumn(UniMainModule.cds_Articles, Column.FieldName, Direction);


    On UniMainModule.SortColumn i do :

    procedure TUniMainModule.SortColumn(const cds:TFDMemTable; const FieldName: string; Dir: Boolean);
    begin
      if Dir
        then cds.IndexName := FieldName+'_index_asc'
        else cds.IndexName := FieldName+'_index_des';
    end;

     

    When i click on the item menu of a DBGrid Column i have a Ajax Error with Unexpected token message.

    {"metaData":{"totalProperty":"results","root":"rows","fields":["0","_0","1","_1","2","_2","3","_3","4","_4","5","_5","6","_6","7","_7","8","_8","9","_9","10","_10","11","_11","12","_12","13","_13","14","_14","15","_15","16","_16","17","_17","18","_18","19","_19","20","_20","21","_21","_x","_r"]},"success":true, "results":4, "rows":[{"id":0,"0":false,"_0":"{fs:'padding:5px;'}","1":true,"_1":"{fs:'padding:5px;'}","2":"S0SAXA0","_2":"{fs:'padding:5px;'}","3":"PROD-DD","_3":"{fs:'padding:5px;'}","4":"A","_4":"{fs:'padding:5px;'}","5":"Buildable","_5":"{fs:'padding:5px;'}","6":"610SAXLA | Streptavidin-XL665 - 5,000 tests","_6":"{fs:'padding:5px;'}","7":"610SAXLA","_7":"{fs:'padding:5px;'}","8":1095,"_8":"{fs:'padding:5px;'}","9":"30/12/1899","_9":"{fs:'padding:5px;'}","10":"TA","_10":"{fs:'padding:5px;'}","11":415,"_11":"{fs:'padding:5px;'}","12":0,"_12":"{fs:'padding:5px;'}","13":34.6,"_13":"{fs:'padding:5px;'}","14":34.6,"_14":"{b:'#FF8080',fs:'padding:5px;'}","15":33,"_15":"{fs:'padding:5px;'}","16":248,"_16":"{fs:'padding:5px;'}","17":true,"_17":"{fs:'padding:5px;'}","18":"SK0AGA0|1\x3Cbr\x3ESTKA|1\x3Cbr\x3ESK0A|1\x3Cbr\x3ESK1A|1\x3Cbr\x3ESK2A|1\x3Cbr\x3ESK3A|1","_18":"{fs:'padding:5px;'}","19":"- SK0AGA0 (1)\x3Cbr\x3E- STKA (1)\x3Cbr\x3E- SK0A (1)\x3Cbr\x3E- SK1A (1)\x3Cbr\x3E- SK2A (1)\x3Cbr\x3E- SK3A (1)","_19":"{fs:'padding:5px;'}","20":true,"_20":"{fs:'padding:5px;'}","21":"\x3Cb\x3ECalcul de la moyenne au lot\x3C/b\x3E\x3Cbr\x3EDate de lancement non renseignée !\x3Cbr\x3EMOY_LOT_CORR SK0AGA0 = 1*(0-\x3E1.2 / 12)\x3Cbr\x3EMOY_LOT_CALC STKA = 1*(83.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK0A = 1*(26.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK1A = 1*(45.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK2A = 1*(32.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK3A = 1*(22.0 / 12)\x3Cbr\x3EMOY_LOT_CALC S0SAXA0 = 1*(207.0 / 12)\x3Cbr\x3EMOY_LOT_CALC = 0.1 + 6.9 + 2.2 + 3.8 + 2.7 + 1.8 + 17.3","_21":"{fs:'padding:5px;'}","_x":1,"_r":0},{"id":1,"0":false,"_0":"{fs:'padding:5px;'}","1":true,"_1":"{fs:'padding:5px;'}","2":"S0SAXB0","_2":"{fs:'padding:5px;'}","3":"PROD-DD","_3":"{fs:'padding:5px;'}","4":"A","_4":"{fs:'padding:5px;'}","5":"Buildable","_5":"{fs:'padding:5px;'}","6":"610SAXLB | Streptavidin-XL665 - 20,000 tests","_6":"{fs:'padding:5px;'}","7":"610SAXLB","_7":"{fs:'padding:5px;'}","8":1095,"_8":"{fs:'padding:5px;'}","9":"30/12/1899","_9":"{fs:'padding:5px;'}","10":"TA","_10":"{fs:'padding:5px;'}","11":103,"_11":"{fs:'padding:5px;'}","12":0,"_12":"{fs:'padding:5px;'}","13":8.6,"_13":"{fs:'padding:5px;'}","14":8.6,"_14":"{b:'#FF8080',fs:'padding:5px;'}","15":27,"_15":"{fs:'padding:5px;'}","16":214,"_16":"{fs:'padding:5px;'}","17":true,"_17":"{fs:'padding:5px;'}","18":"","_18":"{fs:'padding:5px;'}","19":"","_19":"{fs:'padding:5px;'}","20":true,"_20":"{fs:'padding:5px;'}","21":"\x3Cb\x3ECalcul de la moyenne au lot\x3C/b\x3E\x3Cbr\x3EDate de lancement non renseignée !\x3Cbr\x3EMOY_LOT_CALC S0SAXB0 = 103.0 / 12\x3Cbr\x3EMOY_LOT_CALC = 8.6","_21":"{fs:'padding:5px;'}","_x":1,"_r":1},{"id":2,"0":false,"_0":"{fs:'padding:5px;'}","1":true,"_1":"{fs:'padding:5px;'}","2":"S0SAXG0","_2":"{fs:'padding:5px;'}","3":"PROD-DD","_3":"{fs:'padding:5px;'}","4":"A","_4":"{fs:'padding:5px;'}","5":"Buildable","_5":"{fs:'padding:5px;'}","6":"610SAXLG | Streptavidin-XL665 - 3 mg","_6":"{fs:'padding:5px;'}","7":"610SAXLG","_7":"{fs:'padding:5px;'}","8":3650,"_8":"{fs:'padding:5px;'}","9":"30/12/1899","_9":"{fs:'padding:5px;'}","10":"TA","_10":"{fs:'padding:5px;'}","11":271,"_11":"{fs:'padding:5px;'}","12":0,"_12":"{fs:'padding:5px;'}","13":22.7,"_13":"{fs:'padding:5px;'}","14":22.7,"_14":"{b:'#FF8080',fs:'padding:5px;'}","15":21,"_15":"{fs:'padding:5px;'}","16":166,"_16":"{fs:'padding:5px;'}","17":true,"_17":"{fs:'padding:5px;'}","18":"SK0BGA0|1\x3Cbr\x3ESK0JGA0|5\x3Cbr\x3ESTKB|1\x3Cbr\x3ESTKJ|5\x3Cbr\x3ESK1B|1\x3Cbr\x3ESK2B|1\x3Cbr\x3ESK3B|1\x3Cbr\x3ESK1J|1\x3Cbr\x3ESK2J|1\x3Cbr\x3ESK3J|1","_18":"{fs:'padding:5px;'}","19":"- SK0BGA0 (1)\x3Cbr\x3E- SK0JGA0 (5)\x3Cbr\x3E- STKB (1)\x3Cbr\x3E- STKJ (5)\x3Cbr\x3E- SK1B (1)\x3Cbr\x3E- SK2B (1)\x3Cbr\x3E- SK3B (1)\x3Cbr\x3E- SK1J (1)\x3Cbr\x3E- SK2J (1)\x3Cbr\x3E- SK3J (1)","_19":"{fs:'padding:5px;'}","20":true,"_20":"{fs:'padding:5px;'}","21":"\x3Cb\x3ECalcul de la moyenne au lot\x3C/b\x3E\x3Cbr\x3EDate de lancement non renseignée !\x3Cbr\x3EMOY_LOT_CORR SK0BGA0 = 1*(0-\x3E1.2 / 12)\x3Cbr\x3EMOY_LOT_CORR SK0JGA0 = 5*(0-\x3E1.2 / 12)\x3Cbr\x3EMOY_LOT_CALC STKB = 1*(54.0 / 12)\x3Cbr\x3EMOY_LOT_CALC STKJ = 5*(24.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK1B = 1*(23.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK2B = 1*(8.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK3B = 1*(14.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK1J = 1*(13.0 / 12)\x3Cbr\x3EMOY_LOT_CORR SK2J = 1*(0-\x3E1.2 / 12)\x3Cbr\x3EMOY_LOT_CALC SK3J = 1*(2.0 / 12)\x3Cbr\x3EMOY_LOT_CALC S0SAXG0 = 1*(37.0 / 12)\x3Cbr\x3EMOY_LOT_CALC = 0.1 + 0.5 + 4.5 + 10.0 + 1.9 + 0.7 + 1.2 + 1.1 + 0.1 + 0.2 + 3.1","_21":"{fs:'padding:5px;'}","_x":1,"_r":2},{"id":3,"0":false,"_0":"{fs:'padding:5px;'}","1":true,"_1":"{fs:'padding:5px;'}","2":"S0SAXK0","_2":"{fs:'padding:5px;'}","3":"PROD-DD","_3":"{fs:'padding:5px;'}","4":"A","_4":"{fs:'padding:5px;'}","5":"Buildable","_5":"{fs:'padding:5px;'}","6":"610SAXLF | Streptavidin-XL665 - 1,000 tests","_6":"{fs:'padding:5px;'}","7":"610SAXLF","_7":"{fs:'padding:5px;'}","8":1095,"_8":"{fs:'padding:5px;'}","9":"30/12/1899","_9":"{fs:'padding:5px;'}","10":"TA","_10":"{fs:'padding:5px;'}","11":9,"_11":"{fs:'padding:5px;'}","12":0,"_12":"{fs:'padding:5px;'}","13":0.8,"_13":"{fs:'padding:5px;'}","14":0.8,"_14":"{b:'#FF8080',fs:'padding:5px;'}","15":2,"_15":"{fs:'padding:5px;'}","16":50,"_16":"{fs:'padding:5px;'}","17":true,"_17":"{fs:'padding:5px;'}","18":"","_18":"{fs:'padding:5px;'}","19":"","_19":"{fs:'padding:5px;'}","20":true,"_20":"{fs:'padding:5px;'}","21":"\x3Cb\x3ECalcul de la moyenne au lot\x3C/b\x3E\x3Cbr\x3EDate de lancement non renseignée !\x3Cbr\x3EMOY_LOT_CALC S0SAXK0 = 9.0 / 12\x3Cbr\x3EMOY_LOT_CALC = 0.8","_21":"{fs:'padding:5px;'}","_x":1,"_r":3}]}O1FB.load({params:{options:1}});O242.setText("610SAXLA | Streptavidin-XL665 - 5,000 tests\x3Cbr\x3E\x3Cbr\x3E\x3Cb\x3EComposant de\x3C/b\x3E\x3Cbr\x3E- SK0AGA0 (1)\x3Cbr\x3E- STKA (1)\x3Cbr\x3E- SK0A (1)\x3Cbr\x3E- SK1A (1)\x3Cbr\x3E- SK2A (1)\x3Cbr\x3E- SK3A (1)\x3Cbr\x3E\x3Cbr\x3E\x3Cb\x3ECalcul de la moyenne au lot\x3C/b\x3E\x3Cbr\x3EDate de lancement non renseignée !\x3Cbr\x3EMOY_LOT_CORR SK0AGA0 = 1*(0-\x3E1.2 / 12)\x3Cbr\x3EMOY_LOT_CALC STKA = 1*(83.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK0A = 1*(26.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK1A = 1*(45.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK2A = 1*(32.0 / 12)\x3Cbr\x3EMOY_LOT_CALC SK3A = 1*(22.0 / 12)\x3Cbr\x3EMOY_LOT_CALC S0SAXA0 = 1*(207.0 / 12)\x3Cbr\x3EMOY_LOT_CALC = 0.1 + 6.9 + 2.2 + 3.8 + 2.7 + 1.8 + 17.3",false);

     

    It seems like a JSon format and i think it is because there are '<' and '>' tag on data columns (some data have HTML content to format report of the row).

     

    How can i resolve this error ?

    Thanks.

     

  4. I have just modified these lines from the demo :

    procedure TMainForm.UniComboBox1Change(Sender: TObject);
    var
      componentName:string;
    begin
      componentName := UniComboBox1.Items[UniComboBox1.ItemIndex];
      if componentName='Perso' then begin
        UniPropertyGrid1.AttachedComponent := Nil;
        UniPropertyGrid1.AddProperty(['Prop1', 'Value1', 'Prop2', 'Value2']);
      end else
    UniPropertyGrid1.AttachedComponent := MainForm.FindComponent(componentName);
    end;

  5. Hi all,

    I would like to use a uniPropertyGrid component without a AttachedComponent : just like a TValueListEditor component.

    I find the AddProperty function but i don't find an explicit help to use it.

    Is it possible to work with uniPropertyGrid  like a TValueListEditor ?

    Thank you

  6. Hi, here is my suggestion:

    myScrollBox.ClientEvents.ExtEvents.Values['afterrender']:='function afterrender(sender, eOpts) {sender.getEl().dom.style["overflow-x"]="hidden";;}';

    Or

    MyScrollBox -> ClientEvets -> ExtEvents -> function afterrender:

    function afterrender(sender, eOpts)
    {
      sender.getEl().setStyle('overflow-x', 'hidden')
    }

     

     

    • Like 1
  7. That is the code of my First unit :

    unit UniMainForm;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics,  Controls, Forms, uniGUITypes, uniGUIAbstractClasses,  uniGUIClasses, uniGUIForm
      , uDefUser {a unit to manager user};

    type
      TUniMainForm = class(TUniForm)
        procedure UniFormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
        user:TUser;
      end;

    implementation

    {$R *.dfm}

    uses
      UniGUIVars, MainModule, uniGUIApplication;

    procedure TUniMainForm.UniFormCreate(Sender: TObject);
    begin
      initUser(user, True);
    end;


    initialization
      RegisterMainFormClass(TUniMainForm);

    end.

     

    That is the code of my 2d unit :

    unit Main;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, DateUtils
      , Vcl.Imaging.GIFImg, Vcl.Menus, Vcl.Imaging.jpeg, Vcl.Imaging.pngimage
      , Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons, Data.DB
      , uniGUITypes, uniGUIForm, UniListBox, UniMemo, UniLabel, UniPanel, UniPageControl,
      UniButton, UniSpeedButton, uniGUIRegClasses,  uniguiclasses, uniMultiItem, UniBitBtn,
      uniGUIBaseClasses, uniSplitter, uniComboBox, uniScreenMask, uniHTMLMemo,
      uniBasicGrid, uniDBGrid, uniRadioGroup, uniGroupBox, uniSpinEdit,
      uniDateTimePicker, uniMainMenu, uniCheckBox,
      uniImage, uniRadioButton, uniScrollBox
      , uniMainForm
      ;

    type
      TMainForm = class(TUniMainForm)
        PanelUtilisateur: TUniPanel;
        BtnDeconnectUser: TUniSpeedButton;
        UniPanelTop: TUniPanel;
        UniLogoMini: TUniImage;
        UniLabelTitre: TUniLabel;
        UniPanelFond: TUniPanel;
        UniPanelActions: TUniPanel;
        LabelUtilisateur: TUniLabel;
        bkImage: TUniImage;
        UniScrollBox1: TUniScrollBox;
        BtnAction1: TUniBitBtn;
        BtnAction2: TUniBitBtn;
        BtnAction3: TUniBitBtn;
        BtnAction4: TUniBitBtn;
        procedure UniFormCreate(Sender: TObject);
        procedure UniFormShow(Sender: TObject);
        procedure BtnDeconnectUserClick(Sender: TObject);
        procedure UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer);
        procedure BtnAction1Click(Sender: TObject);
        procedure BtnAction2Click(Sender: TObject);
        procedure BtnAction3Click(Sender: TObject);
        procedure BtnAction4Click(Sender: TObject);
      private
        { Private declarations }
        idFct:byte;
        bNeedConnexion:boolean;
        procedure GoAction(id:byte; bRefresh:boolean=False);
      public
        { Public declarations }
        function GetIdAction : byte;
      end;

    function MainForm: TMainForm;

    implementation
    {$R *.dfm}

    uses
      UniGUIVars, MainModule, UniGUIApplication, ServerModule;


    //------------------------------------------------------------------------------
    function MainForm: TMainForm;
    begin
      Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));
    end;

    procedure TMainForm.UniFormCreate(Sender: TObject);
    begin
    ...

    end;

    procedure TMainForm.UniFormShow(Sender: TObject);
    begin
    ...

    end;

    procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer);
    begin
      GoAction(idFct);
    end;

    procedure TMainForm.BtnDeconnectUserClick(Sender: TObject);

    begin
      close;
    end;

    procedure TMainForm.BtnAction1Click(Sender: TObject);
    begin
      GoAction(1);
    end;

    procedure TMainForm.BtnAction2Click(Sender: TObject);
    begin
      GoAction(2);
    end;

    procedure TMainForm.BtnAction3Click(Sender: TObject);
    begin
      GoAction(3);
    end;

    procedure TMainForm.BtnAction4Click(Sender: TObject);
    begin
      GoAction(4);
    end;

    //------------------------------------------------------------------------------
    function TMainForm.GetIdAction : byte;
    begin
      result:=idFct;
    end;

    procedure TMainForm.GoAction(id:byte; bRefresh:boolean);
    var w,h:integer;
        titre:string;
        bOk:boolean;
    begin
      if (user.Login='')and(idFct>0) then exit;

    ...

    end;


    end.

     

     

×
×
  • Create New...