Jump to content

Problem with runtime UniMbitBtn create and 64x64 icon. icon stay displayed in 16x16


Recommended Posts

hi, I try to create at runtime UnimBitBtn with 64x64 icons.

A ) I defined in customSS that  :

  .custom64Glyph .x-icon-el {
   width: 64px !important;
   height: 64px !important;
  }

B )  UnimBitBtn created at design time with Layout.cls=custom64glyph work perfectly

C) Same created at run time do not work.... you can see all my tests in code. see comented line // 'test here' in code.

  UniSession.AddJS('Ext.suspendLayouts()'); // on suspend la mise en place de layout
    for i := 0 to UniMainModule.SbModuleInfoList.Count-1 do
     begin
      AModuleInfo:=UniMainModule.SbModuleInfoList.GetModuleInfoByIndex(i) ;
      if (AModuleInfo.GroupName=GroupId)or(GroupId='*') then
       begin
        AmBitBtn:=TUniMBitBtn.Create(Self) ;
        AmBitBtn.Name:='UnimBitBtn'+AModuleInfo.FModuleId ;

        // here I try to apply the cls .....
        //  test here :  AmBitBtn.JSInterface.JSConfig('cls', ['custom64Glyh']);
        //  test here  : AmBitBtn.JSInterface.JSCall('addCls', ['custom64Glyh']);
        //  test here  UniSession.AddJS(AmBitBtn.JSName + '.addCls(''custom64Glyh'');');
        //  test here : AmBitBtn.JSInterface.JSCall('addCls', ['custom64Glyh']);
        //  test here : Access_LayoutConfig(AmBitBtn.LayoutConfig).Cls:= 'custom64Glyh';
        AmBitBtn.width:=120 ;
        AmBitBtn.Height:=120 ;
        AmBitBtn.Images:=UniImageListModule ;
        AmBitBtn.Imageindex:=AModuleInfo.FIconIdx ;
        AmBitBtn.iconAlign:=iaTop ;
        AmBitBtn.HelpKeyword:=AModuleInfo.FModuleId ;
        AmBitBtn.Tag:=AModuleInfo.FModuleTag ;
        AmBitBtn.font.Size:=12 ;
        AmBitBtn.Caption:=AModuleInfo.FContextName ;
        AmBitBtn.Onclick:=UnimBitBtnModuleClick ;
        AmBitBtn.Parent:=AParent ;
       end;
     end;
    UniSession.AddJS('Ext.resumeLayouts(true)');
    // test here aParent.JSInterface.JSCall('updateLayout', []);
 

please Help

Regards

 

Link to post
Share on other sites

Hi, this is what I defined in the CustomCSS

>>> I use the solution explained by you in this topic  13267 : "Problem Tunimbtbutton with glyph image"

This solution works fine if BitBtn is designed in Delphi.  See property setting "LayoutConfig.Cls=custom64Glyph" 

But I don't know how to set the Layoutconfig.cls when I create the BitBtn at runtime.

You can see all my tries (5) in all the commented lines "// test here" to do that. but without sucess.

1200867020_ClsCustom64GlyphCmpsettingatdesigntime.PNG.b2ff74d6b06cc93ba8b2d6b87c637bd8.PNG1156017449_clsCustom64Glyphserversetting.PNG.ab553bfade0da231b00c7e85fac63905.PNG

Link to post
Share on other sites
18 hours ago, benoitclaeys said:

AmBitBtn.JSInterface.JSConfig('cls', ['custom64Glyh']);

Incorrectly assigned the class name...

Should be:

AmBitBtn.JSInterface.JSConfig('cls', ['custom64Glyph']);

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...