Toolbar Issues in X#2.8
Posted: Fri May 21, 2021 11:00 am
Hi
I'm having some difficulty with toolbars in X#2.8. In VO and X# 2.7 I was able to manually create a toolbar and assign it to the window. With this approach I could define a custom toolbar without the need for a visible menu meaning if I had a window where I just required a few toolbar buttons I could produce a visually cleaner looking UI.
The approach worked as follows
1) Create a menu and assign it to the window oMenu in the window Postinit. This allowed me to access the menu defined method calls.
SELF:oMenu := CustomerEditMenu
2) Manually create a toolbar using the constants from the menu to attach to the desired methods
oTB := Toolbar{}
oTB:ButtonStyle := TB_TEXTANDICON
//oTB:Bitmap := HDStandardRibbon{}
oTB:ButtonSize := Dimension{32, 32}
oTB:Flat := TRUE
oTB:EnableBands(FALSE)
oTB:SetImageList(HDStandardRibbon24Normal{},#IMAGELIST)
oTB:SetImageList(HDStandardRibbon24Disabled{},#DISABLEDIMAGELIST)
oTB:AppendItem(01, IDM_CustomerEditMenu_Close_ID , , , "Close")
oTB:AddTipText(01, IDM_CustomerEditMenu_Close_ID , "Save changes and close")
oTB:AppendItem(02, IDM_CustomerEditMenu_Save_ID , , , "Save")
oTB:AddTipText(02, IDM_CustomerEditMenu_Save_ID , "Save changes and continue")
3) Assign this to the window
SELF:ToolBar := oTB
This approach works in VO and in X# 2.7 but not now in X# 2.8. It appears that I cannot assign an instance of a toolbar to the SELF:Toolbar of the DataWindow in question. In fact while in debug in Visual Studio 2019 a watch variable on SELF:Toolbar returns
error CS1061: 'CustEditWindow' does not contain a definition for 'Toolbar' and no accessible extension method 'Toolbar' accepting a first argument of type 'CustEditWindow' could be found (are you missing a using directive or an assembly reference?)
If I try to simply initialise the toolbar as below
SELF:Toolbar := Toolbar{}
It's value stays at NIL
Has something changed? Can the toolbar now only be created/assigned through the menu?
I have quite a few windows in this app and a larger one I'm hoping to migrate from VO later this year that use the same approach.
Thanks
Karl
I'm having some difficulty with toolbars in X#2.8. In VO and X# 2.7 I was able to manually create a toolbar and assign it to the window. With this approach I could define a custom toolbar without the need for a visible menu meaning if I had a window where I just required a few toolbar buttons I could produce a visually cleaner looking UI.
The approach worked as follows
1) Create a menu and assign it to the window oMenu in the window Postinit. This allowed me to access the menu defined method calls.
SELF:oMenu := CustomerEditMenu
2) Manually create a toolbar using the constants from the menu to attach to the desired methods
oTB := Toolbar{}
oTB:ButtonStyle := TB_TEXTANDICON
//oTB:Bitmap := HDStandardRibbon{}
oTB:ButtonSize := Dimension{32, 32}
oTB:Flat := TRUE
oTB:EnableBands(FALSE)
oTB:SetImageList(HDStandardRibbon24Normal{},#IMAGELIST)
oTB:SetImageList(HDStandardRibbon24Disabled{},#DISABLEDIMAGELIST)
oTB:AppendItem(01, IDM_CustomerEditMenu_Close_ID , , , "Close")
oTB:AddTipText(01, IDM_CustomerEditMenu_Close_ID , "Save changes and close")
oTB:AppendItem(02, IDM_CustomerEditMenu_Save_ID , , , "Save")
oTB:AddTipText(02, IDM_CustomerEditMenu_Save_ID , "Save changes and continue")
3) Assign this to the window
SELF:ToolBar := oTB
This approach works in VO and in X# 2.7 but not now in X# 2.8. It appears that I cannot assign an instance of a toolbar to the SELF:Toolbar of the DataWindow in question. In fact while in debug in Visual Studio 2019 a watch variable on SELF:Toolbar returns
error CS1061: 'CustEditWindow' does not contain a definition for 'Toolbar' and no accessible extension method 'Toolbar' accepting a first argument of type 'CustEditWindow' could be found (are you missing a using directive or an assembly reference?)
If I try to simply initialise the toolbar as below
SELF:Toolbar := Toolbar{}
It's value stays at NIL
Has something changed? Can the toolbar now only be created/assigned through the menu?
I have quite a few windows in this app and a larger one I'm hoping to migrate from VO later this year that use the same approach.
Thanks
Karl