Re: I can not find
"Adrian E. Feiguin" <[email protected]>
| Newsgroups | gmane.comp.scigraphica.gtkextra |
|---|---|
| Message-ID | <[email protected]> |
Hola Danilo,
The best way to create a function is to use
my_function_dataset = gtk_plot_data_new_function(function_ptr);
and then you use it as a regular dataset.
If you need to pass other arguments to the function, you can use several
solutions:
1)
gtk_widget_set_data(GTK_WIDGET(my_function_dataset),
"my_parameter_name", value);
And in the function you retrieve as
value = gtk_widget_get_data(GTK_WIDGET(my_function_dataset),
"my_parameter_name");
This solution could cost some performance though (if you need speed).
2) A second solution
put your parameters in a structure:
typedef struct
{
gdouble a, b, c;
} my_parameters_type;
my_parameters_type parameters;
parameters.a = 0.0;
parameters.b = 1.0;
parameters.c = 3.0;
gtk_plot_data_set_link(my_function_dataset, ¶meters);
and in the function you use:
my_parameters_type *parameters;
parameters = gtk_plot_data_get_link(my_function_dataset);
3) Another way would be to use global variables.
I hope this helps.
Saludos,
<ADRIAN>
danilo lujambio wrote:
>Hi;
>
>can someone tell me How can I use gtk_plot_add_function ?
>
>I have read the gtkplot.c and testgtkplot.c and run it ( the last :-) )
>but I could not see how is used the gaussian function in this example .
>How are passed the parameters to it ?
>
>Thanks in advance
>
>dl
>Argentina
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: INetU
>Attention Web Developers & Consultants: Become An INetU Hosting Partner.
>Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
>INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
>_______________________________________________
>Scigraphica-gtkextra mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra
>
>.
>
>
>
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php