programming question

M

mhodkin

I looking to design a (graphical) program in which a known path (such as anelectrical circuit) can be interrupted by the user. That is, the user canclick the mouse anywhere on a path to "cut" it so that the path is disabled. Once the path is cut, the item connected to the path reacts (such as a light bulb going out). From a high level point of view, what would be the best code / algorithm to design such an interface?
 
B

bradbury9

El miércoles, 3 de abril de 2013 17:11:56 UTC+2, (e-mail address removed) escribió:
I looking to design a (graphical) program in which a known path (such as an electrical circuit) can be interrupted by the user. That is, the user can click the mouse anywhere on a path to "cut" it so that the path is disabled. Once the path is cut, the item connected to the path reacts (such as alight bulb going out). From a high level point of view, what would be thebest code / algorithm to design such an interface?

I would implement an event-driven schema (you can google 'delegate' and 'event' keywords).

Circuit (publisher): Detects user interaction (OnClick, OnMouseOver events)and, if criteria is met, raises the cut event.
Light bulb (subscriber): Subscribes the circuit's cut event and turn on thelight if is not already on.
 
A

Arne Vajhøj

I looking to design a (graphical) program in which a known path (such
as an electrical circuit) can be interrupted by the user. That is,
the user can click the mouse anywhere on a path to "cut" it so that
the path is disabled. Once the path is cut, the item connected to the
path reacts (such as a light bulb going out). From a high level
point of view, what would be the best code / algorithm to design such
an interface?

Typical UI's do not use algorithms.

The code will depend a lot on whether it is Win Forms, WPF,
WinRT, ASP.NET web forms, ASP.NET MVC, GTK# or something else.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top