Discussion: Challenging Logic
Afficher un message
Vieux 10/06/2008, 07h56   #3
akbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Challenging Logic

On May 29, 8:58pm, Nash <jeevs...@gmail.com> wrote:
> Hi,
> I am new to c language and i have a problem to solve. Imagine a
> parent child relationship let me take menu as an example
>
> File Edit
> New Cut
> Window Copy
> Message
> Open
>
> here File and Edit are Top Level Parents(root menu), New and Open are
> children of File. Window and MEssage are children of NEw. Similarly
> Cut and Copy are children of Edit.
>
> I can have only 2 functions like Next and GetSubMenu. Initially i will
> display File when i say next it should show me edit when i say next it
> should show me file.
>
> When i am in File when is say get submenu it should display new and
> now next should give me open and next should take me to File since
> Open is the last child of File. Similary when i am in New and say
> GetSubMenu it should give me Window and Next should give me Message
> and Next should give me New.
>
> I dont know whether i need to use a bidirectional circular linked list
> or array. i need some from you.
>
> Thanks.
> --
> comp.lang.c.moderated - moderation address: c...@plethora.net -- you must
> have an appropriate newsgroups line in your header for your mail to be seen,
> or the newsgroup name in square brackets in the subject line. Sorry.


Hello Nash,

Below structure should solve your problem,

typedef struct my_menu
{
char * my_menu_name;
struct my_menu * child_menu;
struct my_menu * next_menu;
}my_menu;

the 'child_menu' pointer shall point to child menu items, e.g.
File>New menu item
the 'next_menu' pointer shall point the next parent menu item e.g.
File>Edit

I hope this s

Thanks
Akbar
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
  Réponse avec citation
 
Page generated in 0,05616 seconds with 9 queries