Create a toolbar and and attach to a shell window

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
User avatar
Neale
Posts: 24
Joined: Sat Mar 25, 2017 10:40 pm
Location: United Kingdom

Create a toolbar and and attach to a shell window

Post by Neale »

Hello
I am porting my VO business app to XSharp, the app was written some years ago and I am now taking the advantage of using XSharp VO dialect and Visual Studio to start afresh.
I have created a XSharp MDI VO app and started to move code across from VOXPorter, my first problem is attaching a Tooolbar to the ShellWindow, below is the code I am using, the app runs showing the menu with a blank Toolbar ? In my VO app I used SEUIXP not sure if available for XSharp ?

///
/// ShellMenu
///
PARTIAL CLASS ShellMenu INHERIT Menu

CONSTRUCTOR( oOwner )

LOCAL oTB AS Toolbar

SELF:PreInit()
SUPER( ResourceID { "ShellMenu" , _GetInst( ) } )
// more menu code....
oTB := Toolbar{}
oTB:ButtonStyle := TB_ICONONLY
oTB:Flat := TRUE
oTB:EnableBands(FALSE)
oTB:Bitmap := ShellWindowRibbon{}

SELF:Toolbar := oTB

RETURN


/// <summary>
/// ShellWindowRibbon.
/// </summary>
CLASS ShellWindowRibbon INHERIT Bitmap

CONSTRUCTOR(kLoadoption, iWidth, iHeight)
SUPER(ResourceID{"ShellWindowRibbon", _GetInst()},kLoadoption, iWidth, iHeight)
RETURN SELF

END CLASS

/// Resource
ShellWindowRibbon Bitmap ResourcesSHELLWINDOWRIBBON.BMP
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Create a toolbar and and attach to a shell window

Post by Chris »

Hi Neale!

I don't see in the code where/if you are adding buttons to the toolbar, are you doing that? If not, please have a look in the original generated code in the Mdi sample for the menus, it looks like

Code: Select all

	oTB:AppendItem(IDT_CLOSE,IDM_StandardShellMenu_File_Close_ID)
	oTB:AddTipText(IDT_CLOSE,IDM_StandardShellMenu_File_Close_ID,"Close File")

	oTB:AppendItem(IDT_SEPARATOR)

	oTB:AppendItem(IDT_CUT,IDM_StandardShellMenu_Edit_Cut_ID)
	oTB:AddTipText(IDT_CUT,IDM_StandardShellMenu_Edit_Cut_ID,"Cut")
etc.

Regarding SEUIXP, it certainly can be ported to X#, I think I remember someone already did that in the past? If that's true, please step in... Otherwise, please try porting it as a normal library, do you get many errors when trying to compile it in X#?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Create a toolbar and and attach to a shell window

Post by wriedmann »

Hi Neale, hi Chris,
SEUIXP was ported to Vulcan, and starting from this version I was able to move it also to X#.
Please contact Sven Ebert for the X# upgrade of the library.
Porting that library from the VO version may be a bit to difficult as it makes heavy use of the Windows API.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Neale
Posts: 24
Joined: Sat Mar 25, 2017 10:40 pm
Location: United Kingdom

Create a toolbar and and attach to a shell window

Post by Neale »

Hello Wolfgang
Do you have Sven Ebert E mail or new website ? as www.ebertonline.de isn't working ?

Neale
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Create a toolbar and and attach to a shell window

Post by wriedmann »

Hi Neale,
please try ingenieurbuero at ebertonline dot de
The website has been deactivated, but the email works.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Neale
Posts: 24
Joined: Sat Mar 25, 2017 10:40 pm
Location: United Kingdom

Create a toolbar and and attach to a shell window

Post by Neale »

Thank you for that.
Have E mailed and waiting for reply.

Neale
User avatar
Neale
Posts: 24
Joined: Sat Mar 25, 2017 10:40 pm
Location: United Kingdom

Create a toolbar and and attach to a shell window

Post by Neale »

AppendItem works fine for the IDT_Close etc., but I cant seem to create a bitmap resource from my custom toolbar bitmap as
in the code below ?

/// <summary>
/// ShellWindowRibbon.
/// </summary>
CLASS ShellWindowRibbon INHERIT Bitmap

CONSTRUCTOR(kLoadoption, iWidth, iHeight)
SUPER(ResourceID{"ShellWindowRibbon", _GetInst()},kLoadoption, iWidth, iHeight)
RETURN SELF

END CLASS

/// Resource
ShellWindowRibbon Bitmap ResourcesSHELLWINDOWRIBBON.BMP
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Create a toolbar and and attach to a shell window

Post by Chris »

Hi Neale,

Can you please zip and post the solution, so we can have a look?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Neale
Posts: 24
Joined: Sat Mar 25, 2017 10:40 pm
Location: United Kingdom

Create a toolbar and and attach to a shell window

Post by Neale »

Hello Chris

Solution attached.
Attachments
Artisan4.rar
(1.42 MiB) Downloaded 89 times
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Create a toolbar and and attach to a shell window

Post by Chris »

Hi Neale,

Thanks for the file! The first problem is that the compiler thinks that by "Bitmap", you are referring to System.Drawing.Bitmap, a class defined in the system classes. In order to fix this, remove the command "USING System.Drawing" from the beginning of the prg and/or remove the entry "System.Drawing" from the project References.

Next problem is that the file ShellWindowRibbon.rc is saved in unicode format, and unfortunately the windows resource compiler does not like that. To fix this, open the file, select File->Save As, then click on the arrow next to the Save button and select "Save with encoding". Now select from the list "Western European 1252" or any other non-unicode codepage you prefer and it will be fine. Or you can change the text format with an external editor if you prefer.

Now the bitmap will be loaded from the resource. In order to assign one of the bitmaps to the toolbar buttons, you will need to use an appropriate index for oTB:AppendItem(), for example

oTB:AppendItem(1, IDM_ShellMenu_Help_About_ID)

Hope this helps!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply