473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Q: Not *really* a C question...

all
Hi,

This isn't a C question more of a programming question, so I hope it's
ok to post here (I will be coding it in C!)

I've been racking my brains about this little problem and can't see
wood for the trees...

I have to write a c module that gives the user a menu interface to
various options. Dependant on the user, some/most/all menus can be
'turned off'. Rather than have a 'dead-end' if the user navigates to
an 'off' item they should only be able to see the menu options they
can alter.

Example:

FULL MENU
-------------

A-------------------------B
| |
a.1 - a.2 b.1 - b.2
| | | |
x a.2.1 - a.2.2 x x
| |
x x
ALLOWED MENU for user John
==================

A.1----------------------B
| |
x b.1 - b.2
| |
x x

x = function, i.e. do something such as set screen orientation
A, a.1 = menu option eg A is "Screen", and a.1 is "Orientation"
So for Johns menu a.2 and subordinates are not allowed. To keep the
menu structure 'tidy' I have to promote the a.1 option to where A was
as this is only option available on this branch now.

Now the menu must not be 'hard-coded' to allow for
expansion/alteration, so I have created a link-list that points to the
items partner left and right and up and down. I *think* the best way
for me to handle menu items being on or off is to 'fix' the link list
to the full menu structure and have a option within each linked-list
to say if it's off or on.

Is this 'sensible'? I wonder because I can't see an 'easy' way of
dealing with menu items being promoted to higher levels within the
code.

Any help greatly appreciated.
Aug 14 '07 #1
6 1491
al*@sea.org wrote:
Hi,

This isn't a C question more of a programming question, so I hope it's
ok to post here (I will be coding it in C!)
[description of a design for a menu system which dynamically adjusts to
the user snipped]

"ok to post here"? Not really, IMHO.

This is a question about User Interface design and there are almost
certainly better places to look than a group about the C language.

As this is outside my sphere of expertise I'm unable to make a good
suggestion of online resources, but I'd probably start in a good
reference library as I expect your problem has a standard(ish) solution.
I very much doubt that you are the first person to have encountered it.
Aug 14 '07 #2
all
On Tue, 14 Aug 2007 10:43:53 +0100, Mark Bluemel
<ma**********@pobox.comwrote:
>al*@sea.org wrote:
>Hi,

This isn't a C question more of a programming question, so I hope it's
ok to post here (I will be coding it in C!)

[description of a design for a menu system which dynamically adjusts to
the user snipped]

"ok to post here"? Not really, IMHO.
Ok.
>This is a question about User Interface design and there are almost
certainly better places to look than a group about the C language.
Well the user interface is 'designed' I just need to work out how to
code it...
>As this is outside my sphere of expertise I'm unable to make a good
suggestion of online resources, but I'd probably start in a good
reference library as I expect your problem has a standard(ish) solution.
I very much doubt that you are the first person to have encountered it.
That's what I thought, not inventing the wheel here...but been unable
to find anything so far, hence the post.

Regards,
John.
Aug 14 '07 #3
al*@sea.org said:

<snip>
Now the menu must not be 'hard-coded' to allow for
expansion/alteration, so I have created a link-list that points to the
items partner left and right and up and down. I *think* the best way
for me to handle menu items being on or off is to 'fix' the link list
to the full menu structure and have a option within each linked-list
to say if it's off or on.

Is this 'sensible'?
Yes. Another possibility is to maintain a "master" menu that contains
all the options, and create a copy of the menu that contains only the
items allowed for that user. That involves extra space, of course, and
a per-login time cost, but it means that your per-menu-display time
cost is lower.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 14 '07 #4
On Aug 14, 11:31 am, a...@sea.org wrote:
<snip>

I'd recommend you read more about User Interfaces and consider if the
decisions you are making are correct for the interface.

Consistancy is considered a good thing in user interfaces, so
magically dissapearing menus, would be a bad thing as far as
consistency goes.

Consider the annoying menus in Microsoft Office, or the way it deal
with the Start Menu, hiding items that are not used for some time.
Whether you like this or not its not good UI design.

The whole code to hide menus sounds like extra work, extra code that
needs to be debugged and maintained, if there is a good enough reason
you can't just have the menu options listed but unavailable, then you
probably have a good enough reason to create separate clients for each
user level. It'd be much more secure only to include the code each
user level requires in a client. It may sound paranoid but I figure if
you can't show unavailable items in a menu you must be into secret
service application programming, in which case the extra work is
justified by the extra security.
Aug 14 '07 #5
all
On Tue, 14 Aug 2007 10:04:52 -0000, "Very.Little.Gravitas.Indeed"
<Ve*************************@gmail.comwrote:
>On Aug 14, 11:31 am, a...@sea.org wrote:
<snip>

I'd recommend you read more about User Interfaces and consider if the
decisions you are making are correct for the interface.

Consistancy is considered a good thing in user interfaces, so
magically dissapearing menus, would be a bad thing as far as
consistency goes.

Consider the annoying menus in Microsoft Office, or the way it deal
with the Start Menu, hiding items that are not used for some time.
Whether you like this or not its not good UI design.

The whole code to hide menus sounds like extra work, extra code that
needs to be debugged and maintained, if there is a good enough reason
you can't just have the menu options listed but unavailable, then you
probably have a good enough reason to create separate clients for each
user level. It'd be much more secure only to include the code each
user level requires in a client. It may sound paranoid but I figure if
you can't show unavailable items in a menu you must be into secret
service application programming, in which case the extra work is
justified by the extra security.
The requirements for interface states that the menus must be
selectable (on/off) by an 'admin' and that 'off' menus are hidden from
the user. Not so they don't know that there are things to alter but
that they don't have to 'trudge' through things they cannot alter.
Also there won't be a light-mid-high level user that I can create
templates for - it *must* allow zero to full access and anywhere
in-between.

Maybe I mislead people in my question...

It is not a design of the UI that I query, that is 'set-in-stone' for
me, but I just can't see any way to code the requirement (without lots
of switch statements and if else's)! The other 'set-in-stone'
requirement is that the code needs to be oblivious to the menu
structure (as I said the menu structure is planned to be a
linked-list, and that list is the only place where the menu is
defined/hard-coded). So my switch/if routines will/may not be
permissible as they will need to be hard-coded against a set menu
structure.

Kind regards.
Aug 14 '07 #6
On 14 aug, 11:31, a...@sea.org wrote:
Hi,

This isn't a C question more of a programming question, so I hope it's
ok to post here (I will be coding it in C!)

I've been racking my brains about this little problem and can't see
wood for the trees...

I have to write a c module that gives the user a menu interface to
various options. Dependant on the user, some/most/all menus can be
'turned off'. Rather than have a 'dead-end' if the user navigates to
an 'off' item they should only be able to see the menu options they
can alter.
<snip>
So for Johns menu a.2 and subordinates are not allowed. To keep the
menu structure 'tidy' I have to promote the a.1 option to where A was
as this is only option available on this branch now.

Now the menu must not be 'hard-coded' to allow for
expansion/alteration, so I have created a link-list that points to the
items partner left and right and up and down. I *think* the best way
for me to handle menu items being on or off is to 'fix' the link list
to the full menu structure and have a option within each linked-list
to say if it's off or on.

Is this 'sensible'? I wonder because I can't see an 'easy' way of
dealing with menu items being promoted to higher levels within the
code.
The requirement that lone items in a sub-menu must be promoted is not
sensible at all, IMHO.
I would try very hard to put that requirement under discussion. If
necessary, with a prototype that shows the surprising effects of
enabling/disabling an option some levels deep.

If that requirement can be dropped, then you can test ion the display
routine if a menu entry is enabled (and for sub-menu's if they have
any enabled items).
If that requirement has to be fulfilled, I would go with the
suggestion from Richard Heathfield to use a master menu containing all
elements and for each user a (dynamically created) shadow menu that
reflects the visible tree for that user.
>
Any help greatly appreciated.
Bart v Ingen Schenau

Aug 15 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Richard | last post by:
I finally got Mozilla installed and running just last week and wow... Nice work you Mozilla developers, you! And is it just me or does Mozilla really interpret/execute CSS code really well...
38
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
2
by: Visually Seen # | last post by:
Hey everybody! I just want to discuss: what do people really use C# for? According to Microsoft, it was made for rapid software devolopment, and now everybody is on about XML, chat groups etc....
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
131
by: pemo | last post by:
Is C really portable? And, apologies, but this is possibly a little OT? In c.l.c we often see 'not portable' comments, but I wonder just how portable C apps really are. I don't write...
10
by: Stan R. | last post by:
Hi. I'm an old programmer whose been finally reading up on xml the past week. The concepts of xml, dtd, and xsl seem pretty straight forward to me. I understand that xsl (as xslt for...
14
by: dba_222 | last post by:
Dear experts, Again, sorry to bother you again with such a seemingly dumb question, but I'm having some really mysterious results here. ie. Create procedure the_test As
8
by: Vincent RICHOMME | last post by:
Hi, first I would like to apologize about my question because usually I hate specific implementation but in this case I really would like an answer. Besides my example is an example of what's...
12
by: j1230xz | last post by:
Ok now the problem is this. I have compiled some old code with Visual Studio 2008 (the code was originally writen in Visual Studio 6) and i have this error: Error 1 error C2681: 'void *' :...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.