Jump to content

Mobile Toolbar - Disable at Runtime - How ?


andyhill

Recommended Posts

I have a Mobile Toolbar with 3 Containers each holding an object (button, DatePicker etc.).

 

During Runtime there are times when I need to Disable the Toolbar and its objects, ToolBar.Enabled:= False; makes no difference ?

 

Please advise how - Thanks in advance.

Link to comment
Share on other sites

Hi,

 

You can try to use these approaches,

 

Disable:

UnimToolBar1.JSInterface.JSCode(#1'.items.each(function(el){el.disable()});');

Enable:

UnimToolBar1.JSInterface.JSCode(#1'.items.each(function(el){el.enable()});');

Best regards,

Link to comment
Share on other sites

Here is a DFM breakdown of the ToolBar

 

    object ToolBar: TUnimToolBar
      Left = 0
      Top = 0
      Width = 304
      Height = 48
      Hint = ''
      Anchors = [akLeft, akTop, akRight]
      Caption = ''
      object Container0: TUnimToolButton
        Left = 0
        Top = 0
        Width = 48
        Height = 48
        Hint = ''
        CreateOrder = 1
        Style = tbsContainer
        Caption = 'Container0'
        object Prior: TUnimBitBtn
          Left = -177
          Top = 1
          Width = 30
          Height = 47
          Hint = ''
          Flex = 1
          Caption = '<'
          OnClick = PriorClick
        end
      end
      object Container1: TUnimToolButton
        Left = 48
        Top = 0
        Width = 185
        Height = 48
        Hint = ''
        CreateOrder = 2
        Style = tbsContainer
        Caption = ''
        Flex = 4
        DesignSize = (
          185
          48)
        object MyDate: TUnimDatePicker
          Left = 1
          Top = 1
          Width = 242
          Height = 47
          Hint = ''
          Anchors = [akTop, akBottom]
          ClientEvents.ExtEvents.Strings = (
            
              'change=function change(sender, newDate, oldDate, eOpts)'#13#10'{'#13#10'  /*' +
              'ajaxRequest(sender, '#39'_dateChange'#39', ['#39'val='#39'+Ext.Date.format(newDa' +
              'te, Ext.Date.patterns.CustomFormat)]);*/'#13#10'  console.log(newDate)' +
              ';'#13#10'}')
          ClientEvents.UniEvents.Strings = (
            
              'beforeInit=function beforeInit(sender, config)'#13#10'{'#13#10'  config.pick' +
              'er = Ext.create'#13#10'  ('#13#10'    '#39'Ext.ux.picker.DateTime'#39','#13#10'    {'#13#10'    ' +
              '  useTitles: true,'#13#10'      doneButton: true,'#13#10'      cancelButton:' +
              ' true,'#13#10'      slotOrder: ['#39'day'#39', '#39'month'#39', '#39'year'#39'],'#13#10'      toolba' +
              'r:'#13#10'      {'#13#10'        //items : datetimepickettoolbaritems'#13#10'     ' +
              ' }'#13#10'    }'#13#10'  );'#13#10'  Ext.Date.patterns={CustomFormat: "d/m/Y"};'#13#10' ' +
              ' config.dateFormat=Ext.Date.patterns.CustomFormat; '#13#10'}')
          DateFormat = 'dd/MM/yyyy'
          Date = 43185.000000000000000000
          OnAjaxEvent = MyDateAjaxEvent
          OnChange = MyDateChange
        end
      end
      object Container2: TUnimToolButton
        Left = 233
        Top = 0
        Width = 48
        Height = 48
        Hint = ''
        CreateOrder = 3
        Style = tbsContainer
        Caption = 'Container2'
        object Next: TUnimBitBtn
          Left = -177
          Top = 1
          Width = 225
          Height = 47
          Hint = ''
          Flex = 1
          Caption = '>'
          OnClick = NextClick
        end
      end
    end
Link to comment
Share on other sites

×
×
  • Create New...