Jump to content

Point

uniGUI Subscriber
  • Posts

    192
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Point

  1. Does uniGUI have Error Code for every Exception or Does UniGUI have Constanta Message unit file like DBConst.pas so we could customize Exception Message

    procedure TUniServerModule.UniGUIServerModuleException(
      Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);
    begin
      if AException.ErrorCode = 10001 then AException.Message = 'bla bla bla...';
    end;
     

  2. Hi Sherzod,

    seem it didn't mistake in creating the url link, it is proven by using a right click, the link leads to the intended url.

    After I reset the url link by deleting and recreate the url link, it worked fine. 

    i don't know what caused it.

    Many thanks for support.

  3. Hi @Sherzod,

    I modified the code above, so when i click the url link can open a new browser tab. after i implemented this code only works occasionally.

    function initialize(sender, eOpts)
    {
        sender.iframeEl.dom.contentDocument.body.addEventListener('click', function(e) {
          if (e.target.href !== undefined) {
             e.preventDefault();
             window.open(e.target.href, "_blank");
          };
        });
    }

    something wrong with my code?

  4. Base this link:

    https://docs.sencha.com/extjs/7.4.0/classic/src/HtmlEditor.js-1.html

    hope usefull for other.

    @Sherzod, please correct this code if wrong.

    uniDBHTMLMemo -> extEvent -> uniEvent -> beforeInit :

    function beforeInit(sender, config)
    {               
       this.changeFont = function(fontName) {
          this.win.focus();
          this.relayCmd('fontName', fontName);
          this.deferFocus();
       };
        
        
       this.setColor = function(color) {
          this.execCmd('forecolor', Ext.isWebKit || Ext.isIE ? '#' + color : color);
          this.deferFocus();
       };
        
       this.setBGColor = function(color) {
            if (Ext.isGecko) {
                this.execCmd('useCSS', false);
                this.execCmd('hilitecolor', color);
                this.execCmd('useCSS', true);
                this.deferFocus();
            } else {
                this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isWebKit || Ext.isIE ? '#' + color : color);
                this.deferFocus();
            }
       };
     
       this.adjustFont = function(adjust) {      
            var size = this.getDoc().queryCommandValue('FontSize') || '2',
                isPxSize = Ext.isString(size) && size.indexOf('px') !== -1,
                isSafari;
    
            size = parseInt(size, 10);
    
            if (isPxSize) {
                if (size <= 10) {
                    size = 1 + adjust;
                }
                else if (size <= 13) {
                    size = 2 + adjust;
                }
                else if (size <= 16) {
                    size = 3 + adjust;
                }
                else if (size <= 18) {
                    size = 4 + adjust;
                }
                else if (size <= 24) {
                    size = 5 + adjust;
                }
                else {
                    size = 6 + adjust;
                }
    
                size = Ext.Number.constrain(size, 1, 6);
            }
            else {
                isSafari = Ext.isSafari;
    
                if (isSafari) {
                    adjust *= 2;
                }
    
                size = Math.max(1, size + adjust) + (isSafari ? 'px' : 0);
            }
    
            this.relayCmd('FontSize', size);
       };
         
       this.createLink = function() {
            var url = prompt(this.createLinkText, this.defaultLinkValue);
     
            if (url && url !== 'http:/' + '/') {
                this.relayCmd('createlink', url);
            }
       };
         
       this.toggleSourceEdit = function(sourceEditMode) {
            var me = this,
                iframe = me.iframeEl,
                textarea = me.textareaEl,
                hiddenCls = Ext.baseCSSPrefix + 'hidden',
                btn = me.getToolbar().getComponent('sourceedit');
    
            if (!Ext.isBoolean(sourceEditMode)) {
                sourceEditMode = !me.sourceEditMode;
            }
    
            me.sourceEditMode = sourceEditMode;
    
            if (btn.pressed !== sourceEditMode) {
                btn.toggle(sourceEditMode);
            }
    
            if (sourceEditMode) {
                me.disableItems(true);
                me.syncValue();
                iframe.addCls(hiddenCls);
                textarea.removeCls(hiddenCls);
                textarea.dom.removeAttribute('tabIndex');
                textarea.focus();
                me.inputEl = textarea;
            }
            else {
                if (me.initialized) {
                    me.disableItems(me.readOnly);
                }
    
                me.pushValue();
                iframe.removeCls(hiddenCls);
                textarea.addCls(hiddenCls);
                textarea.dom.setAttribute('tabIndex', -1);
                me.deferFocus();
                me.inputEl = iframe;
            }
    
            me.fireEvent('editmodechange', me, sourceEditMode);
            me.updateLayout();
       };  
    }

    ToolBar Button Click :

    procedure TMainForm.MemoToolBarClick(Sender: TObject);
    begin
      with edtCodeContent, JSInterface do begin
        case TUniButton(Sender).Tag of
          0 : JSCall('execCmd', ['bold']);
          1 : JSCall('execCmd', ['italic']);
          2 : JSCall('execCmd', ['underline']);
          3 : JSCall('adjustFont', [1]);
          4 : JSCall('adjustFont', [-1]);
          5 : JSCall('execCmd', ['justifyleft']);
          6 : JSCall('execCmd', ['justifycenter']);
          7 : JSCall('execCmd', ['justifyright']);
          8 : JSCall('createLink', []);
          9 : JSCall('execCmd', ['insertorderedlist']);
          10 : JSCall('execCmd', ['insertunorderedlist']);
          11 : JSCall('toggleSourceEdit', [spdSourceMode.Down]);
        end;
      end;
    end;

    Fore color, Background color and Change Font :

    procedure TMainForm.btcBgColorSelect(Sender: TObject; Color: TColor);
    var
      Aclr : string;
    begin
      Aclr := ReplaceText(uniColor2Web(Color),'#','');
      with edtCodeContent, JSInterface do begin
        JSCall('setBGColor', [Aclr]);
      end;
    end;
    
    procedure TMainForm.btcFontColorSelect(Sender: TObject; Color: TColor);
    var
      Aclr : string;
    begin
      Aclr := ReplaceText(uniColor2Web(Color),'#','');
      with edtCodeContent, JSInterface do begin
        JSCall('setColor', [Aclr]);
      end;
    end;
    
    procedure TMainForm.cbFontNameSelect(Sender: TObject);
    begin
      with edtCodeContent, JSInterface do begin
        JSCall('changeFont', [LowerCase(cbFontName.Text)]);
      end;
    end;

     

  5. Hi Sherzod,

    Previously I had an idea to create a panel containing tools instead of toolbar on unidbHtmlMemo (show toolbar = false), but I don't know what functions for each tool in extjs. and i dont how to execute that function.


    For example, in Delphi I usually make something like this:

    case TButton(sender).tag of
       //change font to bold
       0 : ChangeFontBold; //-> call procedure to bold memo text;
       //change font to italic
       1 : ChangeFontItalic; //-> call procedure to italicmemo text
       //change font to underline
       2 : ChangeFontUnderline; //-> call procedure to underlinememo text;
    
      .
      .
      .
      //and so on
    end;

    best regard.

  6. Below is the incremental changelog for uniGUI - v1.90.0.1554:
    1.90.0 (Equinox)
    +----------------------------------------------------------------------------------------
    .
    .
    
    Bug
    
        [UNG-3277] - Emerald theme is missing.
        [UNG-3278] - Method enable() of undefined property.

    looks like it was fixed in release 1554

  7. sorry sherzod, my english makes you confused, i hope you understand what i mean.

    for example i have 3 menu item on unitreemenu like this:

    menu 1
    menu 2
    menu 3
      sub menu 31
      sub menu 32
      sub menu 33

    i want show tooltip in menu 2 or sub menu 32.

    1. how to display tooltip with extjs code/ext Event
    2. if using CSS like in that thread, what kind selector should be modified

  8. Hi,

    Base on this thread : http://forums.unigui.com/index.php?/topic/9773-hint-exttiptooltip/
    i try to add hint/tooltip on one of treemenu item but still not working:

    function afterrender(sender, eOpts)
    {
        sender.tip = Ext.create('Ext.tip.ToolTip', {
            target: sender.el,
        //delegate: sender.getElementById(MainForm.UniMenuItems1.Test1.id);
            html: '<span class="hintClass">MyHint</span>'
        });

    and i try this code in one of menu item :

    UniMenuItems1.Test1.Caption :=  '<div id="anim"><span class="tooltip" data-tooltip="username must' +
                        ' consist of 29 symbols.">Test 1</span></div>';

    this hint always display inside menu item.

    how to resolve this.

    thanks you in advanced.

×
×
  • Create New...