uniGUI之窗体Form相关设置

1.设置窗体高度

采用CSS样式:

.x-window-header-default-top{padding:10px 5px}

手动设置:

在这里插入图片描述

function window.beforeInit(sender, config)
{
  config.header={title:"fdsfdsf",height:50};
}

2.窗体去掉边框

在UniEvents中填写:

function window.beforeInit(sender, config)
{
   Ext.apply(sender,{border: false,baseCls: '',shadow: false,frame: false,maximizable: false,resizable: false});
}

该方法虽去掉了窗体的边框,但最大化时窗体整体向左上方移动了,导致最右侧流出一部分空白地方,暂没有找到方法解决

3.窗体自适应

将servermodule中的MainFormDisplayMode设置为mfPage

在这里插入图片描述

也可以通过手动设置窗体宽高

在窗体的OnScreenResize事件中填写:

procedure TfrmAddInfo.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer);
begin
  Self.Width := UniApplication.ScreenWidth;
  Self.Height := UniApplication.ScreenHeight;
end;

4.增加tooltip

在uniForm的uniEvent属性中写入以下代码:

function window.OnBeforeInit(sender)
{
   Ext.apply (sender, {
      tools: [{ 
         type: 'pin',
         tooltip: 'tooltip of pin',
         handler: function(event, toolEl, panel){
            ajaxRequest(sender, 'tool', [ 'btn=pin' ] );
         }
      },{ 
         type: 'refresh',
         tooltip: 'tooltip of refresh',
         handler: function(event, toolEl, panel){
            ajaxRequest(sender, 'tool', [ 'btn=refresh' ] );
         }
      },{
         type: 'search', 
         tooltip: 'tooltip of search',
         handler: function(event, toolEl, panel){
            ajaxRequest(sender, 'tool', [ 'btn=search' ] );
         }
      },{ 
         type: 'save',
         tooltip: 'tooltip of save',
         handler: function(event, toolEl, panel){
            ajaxRequest(sender, 'tool', [ 'btn=save' ] );
         }
      }]   
   });
}

在uniForm的AjaxEven事件中:

procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if EventName='tool' then
    ShowMessage('Button '+Params.Values['btn']+' pressed') 
end;

效果:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值