| View previous topic :: View next topic |
| Author |
Message |
Zer01ne
Joined: 08 Sep 2008 Posts: 29
|
Posted: Sun Oct 12, 2008 12:58 am Post subject: int (* handler)(int sel) Help Me |
|
|
Sorry for my bad English
OK
I code a function for use a menu with xy vlfGuiAddMenuEx for perfect text alignement
where is handler ? How to use it in vlfGuiAddEventHandler? please help me
If i finish this function im release this source code on this forum
| Code: | | vlfGuiAddEventHandler(PSP_CTRL_CROSS, -1, i want use handler here, NULL); |
Thanks |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sun Oct 12, 2008 1:09 am Post subject: |
|
|
Read the dc6-7 src, I remember that this function is used to perform the operation of a menu...
I'm not sure, read the src posted by moonlight in the "d6 graphics" thread... _________________ Get Xplora! |
|
| Back to top |
|
 |
Zer01ne
Joined: 08 Sep 2008 Posts: 29
|
Posted: Sun Oct 12, 2008 3:17 am Post subject: |
|
|
| I think but i construct a new function for use a Menu with perfect alignement the function vlfGuiCentralMenu use the VLF_ALIGNEMENT_CENTER for text alignement i code a new function for use a x and y for personalize a Menu and use the param of vlfGuiCentralMenu but a dont know use param int (*handler)(int sel) |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sun Oct 12, 2008 4:36 am Post subject: |
|
|
mmm...
I haven't understand very well what you want to do...
I've see that in the dc src this function is used to reset something parameters...
I've understand that you want to know how to build a function and use it with vlfGuiAddEventHandler, right? _________________ Get Xplora! |
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Sun Oct 12, 2008 4:41 am Post subject: |
|
|
how to use
int vlfGuiAddEventHandler(int buttons, int wait, int (* func)(void *), void *param);
-first arg: pass one of PSP_CTRL_* (or the extra ones defined in vlf.h)
-second arg: time to wait, -1 no delay.
-3rd arg the function that will be called when there is the event (a button has been pressed)
the prototipe of this function hase to be
int myHandlerFunc(void* something)
-the 4th arg is the param that should be passed to the handler func. if you don't need params set it to NULL.
hope it helped |
|
| Back to top |
|
 |
Zer01ne
Joined: 08 Sep 2008 Posts: 29
|
Posted: Sun Oct 12, 2008 9:45 am Post subject: |
|
|
nonono i know use the vlfGuiAddEventHandler but i dont know for use the param int (* handler)(int sel) in my function vlfGuiAddMenuEx Dark_Alex use this param on function vlfAddEventHandler for the vlfGuiCentralMenu
Dark_Alex function
| Code: | | vlfGuiCentralMenu(int noptions, char **items, int defaultsel, int (* handler)(int sel), int dispx, int dispy); |
My function
| Code: | | vlfGuiAddMenuEx(int noptions, char **items, int defaultsel, int (* handler)(int sel), int x, int y); |
how to use the param | Code: | | int (* handler)(int sel) |
in function | Code: | | vlfGuiAddEventHandler(int buttons, int wait, int (* func)(void *), void *param); | for use one function with the PSP_CTRL_CROSS the param | Code: | | int (* handler)(int sel) | receive the user function with the selection for choice Menu you know ? |
|
| Back to top |
|
 |
pspZorba
Joined: 22 Sep 2007 Posts: 156 Location: NY
|
Posted: Sun Oct 12, 2008 11:04 am Post subject: |
|
|
read this wikipedia article : here
when you have understood it, you will see that phobox has answered to your question. _________________ --pspZorba--
NO to K1.5 ! |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Sun Oct 12, 2008 11:45 am Post subject: |
|
|
int (* handler)(int sel)
is a pointer to a function taking an int as a parameter and returning an int.
So if you defined a function
int do_something_with_sel(int sel)
{
return something;
}
You could pass 'do_something_with_sel' to that parameter.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
Onii
Joined: 05 Oct 2008 Posts: 40
|
|
| Back to top |
|
 |
|