Jump to content

dunham

uniGUI Subscriber
  • Posts

    29
  • Joined

  • Last visited

Posts posted by dunham

  1. im' trying to detect the start drag event using :

    unisession.AddJS('var yg = document.getElementById(MainForm.Grid1.id);');
    unisession.AddJS('function dragStart(evt){ ajaxRequest(sender,"drag an item");}');
    unisession.AddJS('yg.draggable = true;');
    unisession.AddJS('yg.addEventListener("dragstart", dragStart, false); ');
    

    it say yg is null :(

  2. Hi , i would like to drag & drop rows between two grids , 

     

    here is the code i used , it seems i forgot something , if some one could help me to fix it please 

    //in first grid:
    
    function beforeInit(sender, config)
    {
    
        
      config.listeners = {
                          plugins: {
                                     ptype: 'gridviewdragdrop',
                                     dragGroup: 'secondGridDDGroup',
                                     dropGroup: 'firstGridDDGroup'
                                   },
                          listeners: {
                             drop: function(node, data, dropRec, dropPosition) {
                             var dropOn = dropRec ? ' ' + dropPosition + ' ' + dropRec.get('name') : ' on empty view';
    
                                                                               }
                                     }
                         }
                         
      
               
    }
    
    
    
    //second grid
    
    function beforeInit(sender, config)
    {
            config.listeners = {
                plugins: {
                    ptype: 'gridviewdragdrop',
                    dragGroup: 'firstGridDDGroup',
                    dropGroup: 'secondGridDDGroup'
                },
                listeners: {
                    drop: function(node, data, dropRec, dropPosition) {
                        var dropOn = dropRec ? ' ' + dropPosition + ' ' + dropRec.get('name') : ' on empty view';
    
                    }
                }
                }
    }
    

    g2g.png

    G2G.zip

  3. hello,

     

    i have got a html frame with 100 lines ,

    i would like to focus on a specific line number. 

     

    is there a method to do that in TUniHTMLFrame component to select the line number that the component show to the user.

     

     

    thank you! 

  4. hi,

    i'm trying Synchronize to communicate between my thread and MainForm, 

    i've got errors 

    
    var 
    iMsBetween : integer;
    
    ...
    
    procedure TThreadResults.DoJob ;
    var
    dTimeDebut : TDateTime;
    dTimeFin : TDateTime;
    i,j:integer;
    begin
      iMsBetween:=0;
      dTimeDebut:=Now;
      for i := 0 to High(integer) do
      begin
         j:=j+1;
      end;
      dTimeFin:=Now;
      iMsBetween := MilliSecondsBetween(dTimeDebut,Now);
    
    
      Synchronize(ThreadMess);
    end;
    
    
    procedure TThreadResults.ThreadMess();
    begin
       
          MainForm.ShowElapsedTime(iMsBetween);
          
    end;
    
    procedure TMainForm.ShowElapsedTime(millisecs:integer);
    begin
       MessageDlg( 'elapsed time: ' + inttostr(millisecs), mtWarning, [mbOK], nil);
    
    end;
    

    i didn't found a classic thread example in the unigui samples for doing this , is there a way for doing this ?

     

     

    source code project:

    http://www.solidfiles.com/d/3e95135c9c/
    

    post-3689-0-24804200-1453713603_thumb.png

  5. Hi,

     

    Can you check again, this code works fine on FF.

     

    Best regards

     

     

    Thank you for the reply, 

     

    this code works for copy and paste between two memos but this is not what i need.

     

    i'm searching to copy a memo 1 to windows clipboard 

     

    if the user need later to paste the content from clipboard : paste content from clipboard into a memo 

  6. Hi,

     

    I think, first of all, you need to analyze for example the following link:

    http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript

     

    Or, if I understand correctly you, try the following solution:

    procedure TMainForm.UniButton1Click(Sender: TObject);
    begin
      UniSession.AddJS(
        'var _input = '+ UniMemo1.JSName +'.inputEl.dom;'+
        UniMemo2.JSName + '.setValue('+ UniMemo2.JSName +'.getValue() + _input.value.substring(_input.selectionStart, _input.selectionEnd))'
      );
    end;

    Best regards.

     

    this code works for internet explorer , actually not working with chrome/firefox

    procedure TMainForm.BtnMemo1CopyClick(Sender: TObject);
    begin
    // copy to clipboard from Memo1
        UniSession.AddJS(
                         'var _input = '+ UniMemo1.JSName +'.inputEl.dom;' +
                         'var_text ='  + '_input.value.substring(_input.selectionStart, _input.selectionEnd);' +
    
                         //this code is working with internet explorer
                         'if( window.clipboardData && clipboardData.setData )'+
                         '{'+
                         'clipboardData.setData("Text", var_text);'+
                         ' } else { '+
                         //this code is not working with firefox/chrome
                         'unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  '+
                         'const clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper); '+
                         'clipboardHelper.copyString(var_text);'+
                         '}'
    
                         );
    end;
    

    here is my full code ( working only with Internet Explorer)

    
    procedure TMainForm.BtnMemo1CopyClick(Sender: TObject);
    begin
    // copy to clipboard from Memo1
        UniSession.AddJS(
                         'var _input = '+ UniMemo1.JSName +'.inputEl.dom;' +
                         'var_text ='  + '_input.value.substring(_input.selectionStart, _input.selectionEnd);' +
    
                         //this code is working with internet explorer
                         'if( window.clipboardData && clipboardData.setData )'+
                         '{'+
                         'clipboardData.setData("Text", var_text);'+
                         ' } else { '+
                         //this code is not working with firefox/chrome
                         'unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  '+
                         'const clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper); '+
                         'clipboardHelper.copyString(var_text);'+
                         '}'
    
                         );
    end;
    
    procedure TMainForm.BtnMemo1PasteClick(Sender: TObject);
    begin
    // Paste from Clipboard to Memo1  (actually working only with internet explorer)
        UniSession.AddJS(
            'if( window.clipboardData && clipboardData.setData )'+
            '{'+
             UniMemo1.JSName +
             '.setValue(' +
             UniMemo1.JSName + '.getValue()'+
             '+"\n"+' +
             'window.clipboardData.getData("Text"));'+
             '}');
    end;
    
    procedure TMainForm.BtnMemo2CopyClick(Sender: TObject);
    begin
    // copy to clipboard from Memo2
        UniSession.AddJS('var _input = '+ UniMemo2.JSName +'.inputEl.dom;' +
                         'var_text ='  + '_input.value.substring(_input.selectionStart, _input.selectionEnd);' +
    
                         'if( window.clipboardData && clipboardData.setData )'+
                         '{'+
                         'clipboardData.setData("Text", var_text);'+
                         '}'+
                         'else'+
                         '{'+
                         'document.execCommand(''copy'');'+
                         '}');
    end;
    
    procedure TMainForm.BtnMemo2PasteClick(Sender: TObject);
    begin
    // Paste from Clipboard to Memo2  (actually working only with internet explorer)
        UniSession.AddJS(
            'if( window.clipboardData && clipboardData.setData )'+
            '{'+
             UniMemo2.JSName +
             '.setValue(' +
             UniMemo2.JSName + '.getValue()'+
             '+"\n"+' +
             'window.clipboardData.getData("Text"));'+
             '}');
    end;
    
    
  7. Hello,

     

     

    i 'm creating a memo at runtime but it doesn't appear on the form,

    can you explain please what's wrong with this code ?

    var MyMemo:TuniMemo;
    begin
                           MyMemo:= TUniMemo.Create(Self);
                           MyMemo.Name:='MyMemo';
                           MyMemo.Left:=10;
                           MyMemo.Top:=10;
                           MyMemo.Width:=164;
                           MyMemo.Height:=89;
                           MyMemo.Hint:='';
                           MyMemo.Visible:=true;
                           MyMemo.BringToFront;
    end;
    

    Test.zip

×
×
  • Create New...