Jump to content

Sherzod

Moderators
  • Posts

    19791
  • Joined

  • Last visited

  • Days Won

    643

Posts posted by Sherzod

  1. Hi Michael Schindler.

     

    Try:



    uniDBGrid1 ExtEvents:


    function cellclick(sender, td, cellIndex, record, tr, rowIndex, e, eOpts)
    {  
    ajaxRequest(this, 'cellclick', []);
    }



    procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
      Params: TStrings);
    begin
      if EventName = 'cellclick' then ShowMessage('cellclick');
    end;


    • Upvote 1
  2. Hi codeb. 

     

    If you need complete cleaning UniStringGrid, think can use store.reload ()

     

    for example:

     

    Try



    uses ... uniGUIApplication ... ;


    UniSession.AddJS(UniStringGrid1.JSName + '.store.reload();');


    Best regards

  3. Hi Michael Schindler.
     
    One of the solutions (I think there are other solutions). 
     
    1. I think you can not use one component at a time for multiple columns (although it is possible, but will slow down, so that every time this component to assign a specific column...   uniGridCellClick (Column: TUniDBGridColumn) not the best place). 
     
    2. When you change the runtime DataSet, you can use instead Column.Editor:= uniDateTimePicker1
     this code: 
    uses ... uniGUIApplication ... ;
    UniSession.AddJS(UniDBGrid1.JSName + '.columnManager.columns[8].setEditor(' + UniDateTimePicker1.JSName + ');');

    3. Or whenever changes DataSet, remove all controls on TUniHidenPanel, and re-create the controls and attach to the column ... 

    //... re-created components in TUniHidenPanel
    
    UniSession.AddJS(UniDBGrid1.JSName + '.columnManager.columns[8].setEditor(' + UniDateTimePicker1.JSName + ');');
    ... 
     
     
    Try ... 
     
    Sincerely.
  4. Hi memoferprof.

     

    Try



    uses ... UniGUIApplication ... ;





    procedure TMainForm.radioGroupClearCheckedClick(Sender: TObject);
    begin
    //radioGroupClearChecked
    UniSession.AddJS('if (Ext.get(' + UniRadioGroup1.JSName + '.items.getAt(0).getChecked()).elements[0]) {Ext.get(' + UniRadioGroup1.JSName + '.items.getAt(0).getChecked()).elements[0].setValue(false)};');
    end;



    Best regards.

    • Upvote 2
  5. How can I get a real name of popupmenu in javascript?

     

    Hi Román Attila.  
     
    I think maybe it's not the best solution, but, gives the result ...
     
    In javascript:
    MainForm.CreateButton1.parentMenu.id;

    CreateButton1 - one of your UniMenuItem UniPopupMenu.

     

    For example: 

    MainForm.CreateButton1.parentMenu.showAt(10, 10);

    post-906-0-11243600-1391172325_thumb.png

     

     

    Best regards

  6. hi  Delphi Developer

     

    yes it is works. Thanks a lot.

     

    additionally can we do this with unisession.addjs ?

     

    Separately (for columns) found a solution in runtime (I do not know can have the best solution).

     

    Try:

     

    hide:

    UniSession.AddJS('Ext.get('+UniDBGrid1.JSName+'.headerCt.columnManager.columns[0].id + "-triggerEl").hide();');

    show:

    UniSession.AddJS('Ext.get('+UniDBGrid1.JSName+'.headerCt.columnManager.columns[0].id + "-triggerEl").show();');

    remove:

    UniSession.AddJS('Ext.get('+UniDBGrid1.JSName+'.headerCt.columnManager.columns[0].id + "-triggerEl").dom.remove();');
  7. Hi Guillermo E. Paulino. 
     
    Try the following: 
     
    1. 
    .searchBox{  
      background:url('images/magnifying-glass.gif') no-repeat !important;  
      padding-left:20px;
    }

    2. not onbeforerender, you need to add to afterrender

    function afterrender(sender, eOpts)
    {
      Ext.get(sender.id + '-inputEl').addCls("searchBox");
    }

    post-906-0-05827200-1390421911_thumb.png

    • Upvote 1
  8.  

    This code works:

    UniSession.AddJS(WebForm.JSName + '.addCls(''borderred'');');
    ...
    UniSession.AddJS(WebForm.JSName + '.removeCls(''borderred'');');
    
     
    Hi Semper. 
     
    You can so, one operator without adding customCSS
     
    UniSession.AddJS(WebForm.JSName + '.el.setStyle({"border": "solid 3px red"});');
    • Upvote 2
  9. Hi mehmet pak.
     
    Well, a simple example, you can like this: 

     

    1. Add the form UniHTMLFrame1. 
    2. UniHTMLFrame1.html add 
    <canvas id="mycanvas" width="400" height="400">  
    </canvas>

    3. UniHTMLFrame1.AfterScript add 

    (function(){    var canvas = document.getElementById('mycanvas'),
            /** @type {CanvasRenderingContext2D} */
            ctx = canvas.getContext('2d'),
            width = 400,
            height = 400,
            half_width = width >> 1,
            half_height = height >> 1,
            size = width * (height + 2) * 2,
            delay = 30,
            oldind = width,
            newind = width * (height + 3),
            riprad = 3,
            ripplemap = [],
            last_map = [],
            ripple,
            texture,
            line_width = 20,
            step = line_width * 2, 
            count = height / line_width;
            
        canvas.width = width;
        canvas.height = height;
        
        /*
         * Water ripple demo can work with any bitmap image
         * (see example here: http://media.chikuyonok.ru/ripple/)
         * But I need to draw simple artwork to bypass 1k limitation
         */
        with (ctx) {
            fillStyle = '#a2ddf8';
            fillRect(0, 0, width, height);
            
            fillStyle = '#07b';
            save();
            rotate(-0.785);
            for (var i = 0; i < count; i++) {
                fillRect(-width, i * step, width * 3, line_width);
            }
            
            restore();
        }
        
        texture = ctx.getImageData(0, 0, width, height);
        ripple = ctx.getImageData(0, 0, width, height);
        
        for (var i = 0; i < size; i++) {
            last_map[i] = ripplemap[i] = 0;
        }
        
        /**
         * Main loop
         */
        function run() {
            newframe();
            ctx.putImageData(ripple, 0, 0);
        }
        
        /**
         * Disturb water at specified point
         */
        function disturb(dx, dy) {
            dx <<= 0;
            dy <<= 0;
            
            for (var j = dy - riprad; j < dy + riprad; j++) {
                for (var k = dx - riprad; k < dx + riprad; k++) {
                    ripplemap[oldind + (j * width) + k] += 128;
                }
            }
        }
        
        /**
         * Generates new ripples
         */
        function newframe() {
            var a, b, data, cur_pixel, new_pixel, old_data;
            
            var t = oldind; oldind = newind; newind = t;
            var i = 0;
            
            // create local copies of variables to decrease
            // scope lookup time in Firefox
            var _width = width,
                _height = height,
                _ripplemap = ripplemap,
                _last_map = last_map,
                _rd = ripple.data,
                _td = texture.data,
                _half_width = half_width,
                _half_height = half_height;
            
            for (var y = 0; y < _height; y++) {
                for (var x = 0; x < _width; x++) {
                    var _newind = newind + i, _mapind = oldind + i;
                    data = (
                        _ripplemap[_mapind - _width] + 
                        _ripplemap[_mapind + _width] + 
                        _ripplemap[_mapind - 1] + 
                        _ripplemap[_mapind + 1]) >> 1;
                        
                    data -= _ripplemap[_newind];
                    data -= data >> 5;
                    
                    _ripplemap[_newind] = data;
    
    
                    //where data=0 then still, where data>0 then wave
                    data = 1024 - data;
                    
                    old_data = _last_map[i];
                    _last_map[i] = data;
                    
                    if (old_data != data) {
                        //offsets
                        a = (((x - _half_width) * data / 1024) << 0) + _half_width;
                        b = (((y - _half_height) * data / 1024) << 0) + _half_height;
        
                        //bounds check
                        if (a >= _width) a = _width - 1;
                        if (a < 0) a = 0;
                        if (b >= _height) b = _height - 1;
                        if (b < 0) b = 0;
        
                        new_pixel = (a + (b * _width)) * 4;
                        cur_pixel = i * 4;
                        
                        _rd[cur_pixel] = _td[new_pixel];
                        _rd[cur_pixel + 1] = _td[new_pixel + 1];
                        _rd[cur_pixel + 2] = _td[new_pixel + 2];
                    }
                    
                    ++i;
                }
            }
        }
        
        canvas.onmousemove = function(/* Event */ evt) {
            disturb(evt.offsetX || evt.layerX, evt.offsetY || evt.layerY);
        };
        
        setInterval(run, delay);
        
        // generate random ripples
        var rnd = Math.random;
        setInterval(function() {
            disturb(rnd() * width, rnd() * height);
        }, 700);
        
    })();
    

    Sincerely...

  10. Hi Hank. 
     
    If I understand correctly, you may like this: 
     
    Try:

     

    1. Edit CSS 
         in ServerModule: 
         uniServerModule -> CustomCSS add 
    .x-tab-default .x-tab-inner {
         font-size: 9px; 
    } 
    2. Or after render uniPageControl1 
    function afterrender (sender, eOpts) 
    {
       Ext.select('.x-tab-default .x-tab-inner').setStyle('font-size', '9px')
    } 
    
    3. Or runtime: 
    UniSession.AddJS('Ext.select(''.x-tab-default .x-tab-inner'').setStyle(''font-size'',''9px'');');

    But these changes will affect all PageControl (and controls that use these classes)!

  11. One of the solutions:

     

    UniDBGrid1 -> ClientEvents -> ExtEvents (Ext.grid.Panel) add afterrender

    function afterrender(sender, eOpts)
    {
      sender.dockedItems.items[1].items.get('first').setTooltip();
      sender.dockedItems.items[1].items.get('prev').setTooltip();
      sender.dockedItems.items[1].items.get('next').setTooltip();
      sender.dockedItems.items[1].items.get('last').setTooltip();
      sender.dockedItems.items[1].items.get('refresh').setTooltip();
    }
  12. It's entirely up to the proxy as to whether or not it will send the http_x_forwarded_for header. Some will and some won't. Whichever proxy you were using when you printed the $_SERVER variable, hasn't send the header.

     

    Even if all proxies did send the header, you would still have a problem because anyone can spoof the http_x_forwarded_for header and so if your script treats that as the real IP, then someone could spoof it to circumvent your IP check.

     

    The best you can do if use $_SERVER['REMOTE_ADDR'] and forget about relying on http_x_forwarded_for. Yes users of proxies will be able to visit your site under a new IP, but this is better than the ability for all users to spoof the IP in http_x_forwarded_for.

     

    As an aid you could maintain a list of known proxies but again this won't ultimately give you the real client IP, it could only tell you if the IP is in your proxy list.
    • Upvote 1
  13. How to identify a user who sits across PROXY?
     

    Common non-standard request headers:

    ...

     

    X-Forwarded-For a de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer

     

    X-Forwarded-For: client1, proxy1, proxy2

    X-Forwarded-For: 129.78.138.66, 129.78.64.103

     

    http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

     

     

    But, it does not work ...: 
    UniSession.RequestHeader ['HTTP_X_FORWARDED_FOR'];

     

    Who can help?

     

    Thank you.
  14. http://try.sencha.com/extjs/4.0.7/examples/charts/gauge/viewer.html

     

    How use:

     

    1. Add to form UniChart1

    2. UniChart1.Legend.Visible := False;

    3. Add UniChart1 - > ClientEvents -> UniEvents add chart.beforeInit(sender)

    function chart.beforeInit(sender){
      var store = Ext.create('Ext.data.JsonStore', {
        fields: ['value'],
        data: [
            { 'value':70 }        
        ]
      });
      
      sender.store = store;
      //sender.width = 200;  
      sender.margin = 20;
      sender.height = 200;
      sender.animate = true;
      sender.animate = {
                    easing: 'bounceOut',
                    //easing: 'elasticIn',
                    duration: 1000
                    };
      sender.insetPadding = 30;
      sender.axes = [{
            type: 'gauge',
            position: 'gauge',
            minimum: 0,
            maximum: 100,
            steps: 10,
            margin: 10
        }];
      sender.series = [{
            type: 'gauge',
            field: 'value',
            donut: 30,
            colorSet: ['#F49D10', '#ddd']
        }];
    }

    post-906-0-26862000-1389443249_thumb.png

     

    Result:

    post-906-0-96143000-1389443424_thumb.png

     

    setValue:

    UniSession.AddJS('Ext.getCmp('+UniChart1.JSName+'.items.getAt(0).id).store.getAt(0).set(''value'', Math.round(Math.random()*100));');
    UniSession.AddJS('Ext.getCmp('+UniChart1.JSName+'.items.getAt(0).id).store.getAt(0).set(''value'', 90);');
    • Upvote 1
×
×
  • Create New...