Jump to content
Software FX Community

Creating new toolbar item


User (Legacy)

Recommended Posts

I am trying to create a new item on the existing toolbar I have for my graph

and I reading the Adding Custom Commands under Samples & Resources.

I have managed to create a new icon using this sample, but when I read about

Processing Commands, it says UserCommands are only used in Win Forms dev and

not web forms, so what is the coding for Web Forms dev??

I am trying to recreate icon for exporting the graph as a metafile and

trying to fit in this line of code for my new icon:

Link to comment
Share on other sites

Sorry, sent it by mistake and I havent finished.

Anyway I want to fit the following for my new icon

this.Chart1.Export( FileFormat.Metafile, @"c:\\temp\\cfx.emf");

Please give me guidance on how to achieve this? And answer my prev

question.....what is the coding for web form dev equivalent to

UserCommands??

TIA

Elvina

"Elvina Lam" <elam@europeancredit.com> wrote in message

news:XbGWlKfrDHA.1900@WEBSERVER1...

> I am trying to create a new item on the existing toolbar I have for my

graph

> and I reading the Adding Custom Commands under Samples & Resources.

>

> I have managed to create a new icon using this sample, but when I read

about

> Processing Commands, it says UserCommands are only used in Win Forms dev

and

> not web forms, so what is the coding for Web Forms dev??

>

> I am trying to recreate icon for exporting the graph as a metafile and

> trying to fit in this line of code for my new icon:

>

>

Link to comment
Share on other sites

Web Forms component run in the server. You can not capture toolbar events in

the server as these occur in the client.

The UserCommand event can be captured in the CLIENT, where the Windows Forms

component is running within the browser. UserCommand events DO NOT generate

a post-back.

In this particular case, what you want to do is something like:

<script for="Chart1" event="UserCommand(nID)">

Chart1.Export( FileFormat.Metafile, @"c:\\temp\\cfx.emf"); // This is

done in the client

</script>

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Does that mean that the code I wrote for producing this new icon needs to be

in the client (html page) too?

I have

//remove first icon on toolbar

this.Chart1.ToolBarObj.RemoveAt(0, 2);

//Add a command ID to the command list

Chart1.Commands.AddCommand(4);

//Set the Style of the command button

Chart1.Commands(4).Style = CommandStyle.PreferImage ;

//Set an icon for the new commmand

Chart1.Commands(4).Picture = 2;

//Set a customTooltip

Chart1.Commands(4).Text = "Copy as Metafile";

//Insert a new item in the 4th position of the Toolbar

Chart1.ToolBarObj.InsertAt(0,1);

//Now assign the command id to added button

Chart1.ToolBarObj[0] = CommandID(4);

..Im not too familar with scripts, so if I put the script for the event in

the html page, how do I link the icon to this event?

Thanks

Elvina

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:JVVOl7grDHA.3336@WEBSERVER1...

> Web Forms component run in the server. You can not capture toolbar events

in

> the server as these occur in the client.

>

> The UserCommand event can be captured in the CLIENT, where the Windows

Forms

> component is running within the browser. UserCommand events DO NOT

generate

> a post-back.

>

> In this particular case, what you want to do is something like:

>

> <script for="Chart1" event="UserCommand(nID)">

> Chart1.Export( FileFormat.Metafile, @"c:\\temp\\cfx.emf"); // This is

> done in the client

> </script>

>

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Thanks for the advice, I managed to get it working but I have one problem.

I put it on our Intranet, which means that exporting the graph to c://temp//

will mean the graph will be exported to the temp dir on the server.....Is

there anyway I can export metafile to client machine? I think this doesnt

have much to do with ChartFX really, but needed someones opinion.

Thanks

Elvina

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:Q7XH9errDHA.1900@WEBSERVER1...

> No. The code that customizing the toolbar can stay in the server. The code

> that RESPONDS to that command must be in the client.

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

If you are exporting as a result of the UserCommand event, this code is

running in the CLIENT, therefore "c://temp//..." will refer to a file in the

Client Machine.

In general, running Export in the server will export to a file in the

server, running Export in the client will export a file in the client.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Oh yeah, that makes sense. I had it in on the server side. I will put it on

the client side.

Thanks...I didnt twig on that at all.

Elvina

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:nOcFFT3rDHA.1560@WEBSERVER1...

> If you are exporting as a result of the UserCommand event, this code is

> running in the CLIENT, therefore "c://temp//..." will refer to a file in

the

> Client Machine.

>

> In general, running Export in the server will export to a file in the

> server, running Export in the client will export a file in the client.

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Im having problems with putting it into the client

I have the following on the server, this create new icon

//remove first icon on toolbar

this.Chart1.ToolBarObj.RemoveAt(0, 2);

//Add a command ID to the command list

Chart1.Commands.AddCommand(4);

//Set the Style of the command button

Chart1.Commands[4].Style = CommandStyle.PreferImage ;

//Set an icon for the new commmand

Chart1.Commands[4].Picture = 5;

//Set a customTooltip

Chart1.Commands[4].Text = "Copy as Metafile";

//Insert a new item in the 4th position of the Toolbar

Chart1.ToolBarObj.InsertAt(0,1);

//Now assign the command id to added button

Chart1.ToolBarObj[0] = this.Chart1.Commands[4].ID;

And I have the following in html page as script

<script for="Chart1" event="UserCommand(nID)">

if (nID = 4)

{

Chart1.Export( FileFormat.Metafile, @"c:\\temp\\cfx.emf");

}

</script>

It doesnt give me any error messages, just doesnt work. What am I missing??

TIA

Elvina

"Elvina Lam" <elam@europeancredit.com> wrote in message

news:Y1drFq3rDHA.3336@WEBSERVER1...

> Oh yeah, that makes sense. I had it in on the server side. I will put it

on

> the client side.

>

> Thanks...I didnt twig on that at all.

>

> Elvina

> "SoftwareFX Support" <support@softwarefx.com> wrote in message

> news:nOcFFT3rDHA.1560@WEBSERVER1...

> > If you are exporting as a result of the UserCommand event, this code is

> > running in the CLIENT, therefore "c://temp//..." will refer to a file in

> the

> > Client Machine.

> >

> > In general, running Export in the server will export to a file in the

> > server, running Export in the client will export a file in the client.

> >

> > --

> > FP

> > Software FX, Inc.

> >

> >

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...