cemurphy@vax1.tcd.ie (02/12/91)
Hello All......and help! The application I am developing has a collection of nodes and links that each has a visual front-end to them; I am displaying a graph structure on the screen. I want to be able to 'select' one of these previously created objects (e.g. a node) and to RESIZE it (e.g. make it bigger). I want to be able to 'select' one of these previously created objects (e.g. a node) and to change its SHAPE (e.g. by clicking on the desired shape from a selection of possible shapes being displayed in a pop-up window. I have achieved the basic visualizations needed (e.g. the pop-up window showing the possible shapes) and devguide generates the C++ code. Fine. I am provided with the relevant notifier handlers and event handlers. However I am confused about something. Let's say that there already exists a graph on the screen. The user now wants to change the shape of one of the nodes. He/she selects the particular node by clicking on it. HOW DO I KNOW WHAT NODE IS BEING REFERENCED BY THE USER VIA THIS PARTICULAR CANVAS WINDOW EVENT? A Proposed solution: ^^^^^^^^^^^^^^^^^^^ AT the moment I am using a bounding rectangle notion to represent the nodes; I am storing the top-left-rectangle-point and the bottom-right-rectangle-point and the node's shape as an integer (actually an enumerated type "shapes"). Based on the 'shape' datum and the bounding rectangle I can draw the node to the correct SIZE and at the correct LOCATION. When the user makes the 'click' on the canvas window, the canvas window's event handler is called by the Notifier; I can then check whether the cursor's hotspot is actually within a particular bounding rectangle and if so, which node is being referenced. Do you think this would work? Do you think it would be inefficent? Are there standard ways of achieving this in XView programming? It seems a pity that I can't have the Notifier call the relevant handler for each particular node, like it does when I (for example) click on a menu button. Thanks for you help, Cormac!