Jump to content

zhyhero

uniGUI Subscriber
  • Posts

    131
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by zhyhero

  1. Sorry for missed the point.

    In you testcase,

    #1'.iframe.contentWindow.myAlert();'   =>   UniURLFrame1.JSName+'.iframe.contentWindow.myAlert();' 

    UniURLFrame1.JSName => O5E or other ...

    O5E is on the Tree.

    I guess #1 just a placeholder, it will replace by some jsname on runtime.

    try

    UniURLFrame1.JSInterface.JSCode('O5E.iframe.contentWindow.myAlert();');

    unisession.addjs('O5E.iframe.contentWindow.myAlert();');

     

    And in you index.html file

    <script>

      function myAlert() {


           alert('peek-a-boo I see you');


           console.log('out -> ',this); // this will be O5E.iframe.contentWindow 


         };

    </script>

     

     

    top => O5E's parent   ,root of the Tree.

  2. The world is "Tree" .

     Run unigui app, open url in browser, and the developer-tool will tell you what is inside it.

    Type and run “console.log(this)” in developer-tool.

    (This pic shows how current session objects are organized like a tree inside the browser vm , and "this" is a "Window" type object. )

    Dev-Tool.thumb.png.95312aa2ecb476689aab1d53292c4eab.png

    Every object may have a name ,like O6A,O10....... and MainForm.

     

    When you include an outside js file,it's content will append to the "Tree".

    Example ,we define a function in file "jsfunc.js",

    function ___js_func_1(){

        alert("call js_function");

    }

    and add "/files/jsfunc.js" to servermodule.customfiles.

    When uniapp initialized, the function "___js_func_1"  will append to the object tree (this is "Window").

    jsfunc1.png.28881b7ee8f0d6c66df1c6a246b11b72.png

    Or we put an TUniHTMLFrame on a UniForm, set HTML property with:

    <head>
    <script>
    function ___my_func_good(){ alert('good'); }  // function append to "Window"

    var ___mytools={};  // object append to "Window"
    ___mytools.good=function (){ alert('good'); }  //function append to "Window".___mytools

    </script>
    </head>
    <body>
    hello<br>
    <input type="button" value="click good" onclick="___my_func_good()"></input>
    </body>

     

    At runtime, "___my_func_good" and "___mytools" will append to the tree (this is "Window"), like pic shows.

    Usually,we just simple  call "this.___js_func_1()",   "this.___myfunc_good()" and "this.___mytools.good()".

    Unisession.AddJs('this.___js_func_1();');

     

    You can add any new child object(or function) to any object on the tree, so it is important to make sure what is "this".

    If you dynamic create js objects or functions in runtime , you may consider how to organize them on the "Tree"

     

     

  3. I add an UniCombobox to UniDBgrid's HeadTitle area,

       self.UniDBGrid_Sample.JSInterface.JSCall('header.insert', [1, self.UniComboBox1.JSControl]);

    P1.png.521aeb9c4161501ff4202fa74565ed6e.png

    but height of headertitle area become more bigger,

    so i reset the height of headertitle area to default,

       self.UniDBGrid_Sample.JSInterface.JSCall('header.setHeight', [HeaderHeight]);

    P2.png.00b99a72a9d66300919a8141bc902ba2.png

    now , the position of  titletext and unicombobox become strange, how to fix this?

    source code 20230120_UniDBGrid_Combobox.zip

  4. How about check "InTransaction" ?

     

      if  FDConnection.InTransaction then
      begin
        ShowmessageN('Last Transaction is not finish');
        Exit;
      end;

     

      FDConnection.StartTransaction;

      try

          ...

          FDConnection.Commit;

      except

          FDConnection.Rollback;

      end;

  5. On 10/11/2022 at 1:36 PM, Denton said:

    Hi

    Here.. if u remove the OnCellClick event the bug wont show...

    GridCheckBox.rar 7.64 kB · 4 downloads

    I am not sure this is helpful , something (procedure or function) delayed untill OnCellClick. 

    So i changed your source code.

     

    type

      TMainForm = class(TUniForm)
        UniDBGrid1: TUniDBGrid;
        UniDBNavigator1: TUniDBNavigator;
        DataSource1: TDataSource;
        procedure UniFormCreate(Sender: TObject);
        procedure UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer);
        procedure UniDBGrid1CellClick(Column: TUniDBGridColumn);
      private
        { Private declarations }
        DeleteJobReady: boolean;
      public
        { Public declarations }
      end;

    function MainForm: TMainForm;

    implementation

    {$R *.dfm}

    uses
      uniGUIVars, MainModule, uniGUIApplication, StrUtils;

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

    procedure TMainForm.UniDBGrid1CellClick(Column: TUniDBGridColumn);
    begin
      if DeleteJobReady then
      begin
        UniMainModule.ClientDataSet1.Delete;
        DeleteJobReady := false;
      end;

    end;

    procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer);
    begin
      DeleteJobReady := true;
    end;

    procedure TMainForm.UniFormCreate(Sender: TObject);
    var
      I: Integer;
    begin
      DeleteJobReady := false;
      with UniMainModule.ClientDataSet1 do
      begin
        for I := 1 to 100 do
        begin
          Append;
          FieldByName('EmpNo').AsInteger    := I;
          FieldByName('Lastname').AsString  := Char(65 + Random(28));
          FieldByName('Firstname').AsString := Char(65 + Random(28));

          FieldByName('shift').AsBoolean     := Random(2) = 1;
          FieldByName('BoolInt').AsInteger   := Random(2);
          FieldByName('Boolstring').AsString := IfThen(Random(2) = 0, 'set', 'unset');
          Post;
        end;
        First;
      end;
    end;

     

  6. 0. Loading error

    Theme: uni_windows11_triton

    Messages:

    GET http://localhost:8077/unipackages-7.5.1-1.70/themes/ext-theme-uni_windows11_triton/resources/fonts/OpenSans-Light.ttf net::ERR_ABORTED 404 (Not Found)
    GET http://localhost:8077/unipackages-7.5.1-1.70/themes/ext-theme-uni_windows11_triton/resources/fonts/OpenSans-Regular.ttf net::ERR_ABORTED 404 (Not Found)

    Loading_error.thumb.png.af3cb5bfcbec58985a478d0d8c38e322.png

     

    1.CheckBox Icon lost

    Theme:  uni_windows11, uni_windows11_triton

    cls-class:  x-grid-checkcolumn-checked...

    Condition:  ServerModule.IncludeFontAwesome4=false;

    Check_0.png.186d01ae5cf56f0fc80caf0ba0b7a3b5.png

    2.ActionColumn row Icon(Button) Lost

    Condition: Set Column.Title.Caption With some html tag like "<i></i>"

    How to fix this ?????👀

    Check_1.png.d29e1096673912b49529304578c7c080.png

     

    BTW,  ActionColumn.Button.IconCls='fa fa-circle'

    Check_2.png.22e9d5f81132d148c0b4031ba45c54b3.png

    Here is Demo source code Fontawesome_Test2_20221009.zip

  7. On 1/17/2022 at 8:45 AM, mikromundo said:

    Try use UTF8.

    The test was successed running by VCL Application mode,    no need change souce file to UTF8.

    And if there has only one  AureliusDatasetXXXXXX object (TSomeField type, Not the entity class) declare with none english characters name  ,it may successed running by Unigui Application mode.

    look call statck ==> ObjectTextToBinary()->.............->TParser.TokenString-> TEncoding.GetString()

    I guess there have some problem during  "cast .dfm file or it's TStream object" process.

     

×
×
  • Create New...