Jump to content

Point

uniGUI Subscriber
  • Posts

    192
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Point

  1. 1 hour ago, Frederick said:

    I am not sure what I am doing wrong but the forms are not displaying inside the TUniTabSheet of the TUniPageControl.

    I have two application forms and my code when each TUniMenuItem is clicked is:-

    procedure TMainForm.mnu1Click(Sender: TObject);
    var
       cMenu : String;
    begin
       cMenu:=treMenu.SourceMenu.Items[treMenu.Selected.Id].Name;
       if assigned(oForm) then
          oForm.Close;
       oForm:=NIL;
       if cMenu='mnu1' then begin
          oForm:=frmForm1;
         end
       else if cMenu='mnu2' then begin
          oForm:=frmForm2;
       end;
       if assigned(oForm) then
          oForm.Parent:=tab1;
    end;

    However, the application forms are displayed outside the main form. What could be the problem?

    you must create a form like i wrote above.

    here the clue :

    1. use free form

    2. global variable for a form (must thread safe variable)

    3. release form's variable when you load another form

    4. pure OOP, to avoid memory leak. use override and virtual method

     

     

  2. Hi @Sherzod,

    i got error when compile this line,

    procedure TUniColorComboBox.LoadCompleted;
    begin
      inherited;
    
      SetDomStyleCSSProperty('z-index', '10', '.x-colorpicker-field-swatch');
      SetDomStyleCSSProperty('left', '2px', '.x-colorpicker-field-swatch');
      SetDomStyleCSSProperty('width', FColorWidth, '.x-colorpicker-field-swatch');
    
      --> JSAddElEvent('click', 'swatchEl', ['this'], 'this.component.onTriggerClick()', nil, JSControl);
    .
    .
    .
    end;

    No error when i change with this : 

    JSAddElEvent('click', 'swatchEl', ['this'], 'this.component.onTriggerClick()');

    may i change it like that?

  3. hi Frederick,

    Put unicontainer, panel or pagecontrol on area A, then embed a form or aframe, use create an release's technique to reduce memory usage.  

    for example like this :

    AForm := TUniForm1.Create(UniSession.uniApplication)
    AForm.parent := unicontainer1;

    AFrame := TUniForm1.Create(MainForm)
    AFrame.parent := panel1; //uniTabsheet1;
     

  4. hi Frederick,

    If using sourcemenu, Maybe something like this:

    - To get component name of menu item:
    
    procedure TUniForm1.UniTreeMenu1Click(Sender: TObject);
    var
      IdxMenuItem: Integer;
    begin
      IdxMenuItem := UniTreeMenu1.Selected.Id;
    
      ShowMessageN(UniTreeMenu1.SourceMenu.Items[IdxMenuItem].Name);
    end;
    
    - To get caption of menu item:
    
    procedure TUniForm1.UniTreeMenu1Click(Sender: TObject);
    var
      IdxMenuItem: Integer;
    begin
      IdxMenuItem := UniTreeMenu1.Selected.Id;
    
      ShowMessageN(UniTreeMenu1.Items[IdxMenuItem].Text);
    end;


    Change Font : 

    http://forums.unigui.com/index.php?/topic/10643-unitreemenu-font-size/
    http://forums.unigui.com/index.php?/topic/11120-how-to-reduce-fonts-on-unitreemenu/
    http://forums.unigui.com/index.php?/topic/12460-tunitreemenu-change-font/
     

     

  5.  

    13 minutes ago, Point said:

    hello,

    load mask only once when before create a frame and hide mask after created.

    procedure TAframe.UniFrameCreate(Sender: TObject);
    begin
      UniSession.AddJS('MainForm.form.mask()');
    end;

    procedure TfmToolbarThemes.UniFrameReady(Sender: TObject);
    begin
      UniSession.AddJS('MainForm.form.unmask()');
    end;

    -> Mask not shown.

    ====

    abutton on design time => screenmask.enabled = true;

    procedure mainform.abuttonOnClick(Sender: TObject);
    begin
      if not frame created then begin
        do create A frame
        AButton.screenmask.enabled = false;
      end else ...
    end;

    -> mask keep showing every click button.

    any suggestion where i have to put mask and unmask.

    thanks.

    ps : i am not using Synchronous Operations.

  6. hello,

    load mask only once when before create a frame and hide mask after created.

    procedure TAframe.UniFrameCreate(Sender: TObject);
    begin
      UniSession.AddJS('MainForm.form.mask()');
    end;

    procedure TfmToolbarThemes.UniFrameReady(Sender: TObject);
    begin
      UniSession.AddJS('MainForm.form.unmask()');
    end;

    -> Mask not shown.

    ====

    abutton on design time => screenmask.enabled = true;

    procedure mainform.abuttonOnClick(Sender: TObject);
    begin
      if not frame created then begin
        do create A frame
        AButton.screenmask.enabled = false;
      end else ...
    end;

    -> mask keep showing every click button.

    any suggestion where i have to put mask and unmask.

    thanks.

  7. 9 hours ago, Sherzod said:

    Solved?

    not using action column or badgetext, just using OnCalcField and Superscript tag. 🙂

    procedure TMainForm.ClientDataSet1CalcFields(DataSet: TDataSet);
    begin
      if ClientDataSet1.FieldByName('EmpNo').AsInteger mod 2 = 1 then
        ClientDataSet1.FieldByName('Notif').AsString := '<i class="fas fa-globe-asia"; style="color:blue;"></i><sup>' + ClientDataSet1.FieldByName('EmpNo').AsString + '</sup>'
      else
        ClientDataSet1.FieldByName('Notif').AsString := '<i class="fas fa-globe-asia"; style="color:goldenrod;"></i>';
    end;


    if use badgetext maybe it will be better.

    • Happy 1
  8. what do you think if I rewrite the badgetext.js file and change the button type to actioncolumn like this:
     

    	init: function(actioncolumn){
    
    		var me = this;
    
    		me.actioncolumn = actioncolumn;
    		me.text = me.defaultText;
    
    		actioncolumn.on('render', me.addBadgeEl, me);
    
    		Ext.apply(actioncolumn,{
    
    			setBadgeText:function(text){
    
    				me.disable = typeof text == 'undefined' || text === me.defaultText;
    				me.text = !me.disable ? text : me.defaultText;
    				if (actioncolumn.rendered) {
    					actioncolumn.badgeEl.update(text.toString ? text.toString() : text);
    					if (Ext.isStrict && Ext.isIE8) {
    						actioncolumn.el.repaint();
    					}
    					me.setDisabled(me.disable);
    				}
    				return actioncolumn;
    			},
    
    			getBadgeText:function(){
    				return me.text;
    			}
    
    
    		});
    
    	},

    i've tried it, but still not come out. 

  9. On 6/27/2021 at 2:45 AM, Sherzod said:
    function beforeInit(sender, config)
    {
      config.style={'overflow': 'visible'};
      sender.action = 'badgetext'; 
      sender.plugins = [
                            {
                                ptype:'badgetext',
                                defaultText: 10,
                                disableOpacity:1,
                                disableBg: 'green',
                                align:'right'
                            }
                      ];
    }

    hello,

    Hope it could be implemented on the grid action button. but I haven't been able to find a way.

    i try on here :

    function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
    {
      //console.log(columns[0].items[0]);
      var act = columns[0].items[0];
      
      act.style={'overflow': 'visible'};
      act.action = 'badgetext'; 
      act.plugins = [
                            {
                                ptype:'badgetext',
                                defaultText: 0,
                                disableOpacity:1,
                                disableBg: 'green',
                                align:'right'
                            }
                      ];
      
    }

    and the final goal is showing value on badgetext:

    procedure TMainForm.ClientDataSet1CalcFields(DataSet: TDataSet);
    var
      bJSName: string;
    begin
      bJSName := UniDBGrid1.Columns[0].ActionColumn.Buttons.Items[0].JSName;
      UniSession.AddJS(bJSName + '.setBadgeText(' + bJSName + '.getBadgeText() + ' +
                 ClientDataSet1.FieldByName('EmpNo').AsString + ');');
    end;

    best regards.

×
×
  • Create New...