473,563 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "Orientatio n"
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 1497
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**********@p obox.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.Gr avitas.Indeed"
<Ve************ *************@g mail.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
2497
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 especially compared with IE? And those browsing tabs, and "realtime fluid resizing"... It's like a world of difference. ....I am tempted to code just for...
38
3287
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 or is it a benefit that C knows nearly nothing (what I can think about is that C is the largest common divisor defined on most available platforms)?
2
1554
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. and so much on the internet, why can't we just stick with Windows Forms? P.S. The main reason I love C# so much is because it is so good for...
59
4950
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 ASP.NET. At first glance, it looks excellent, albeit nothing that couldn't have been done to Classic ASP. I have been through a few tutorials and was...
131
6042
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 portable C code - *not only* because, in a 'C sense', I
10
1543
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 transformations) can be used to transform xml data from an xml document into another document, as specified in the templates. One of the best examples I've...
14
5884
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
2328
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 not to be done but I am aware of that. Don't loose time tell me that I should use standard implementation and consider my question as theoretical....
12
2972
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 *' : invalid expression type for dynamic_cast c:\Works\BaCCTester\Dev\Addins\Utils \CommonDataManipulators\Sources\CommonDataFree.cpp 121...
17
5791
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: _________________________________________________________________ /* Simple Thread Object ______________________________________________________________*/ #include <pthread.h> extern "C" void* thread_entry(void*);
0
8103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.