PDA

View Full Version : The nodes in active view tree don't have unique names.


Tom David
11-20-2007, 03:29 AM
Hi Guys,

I was not sure if I should put my issue right away into the development plan, so I opened this thread to discuss about it.

I have quite some problems with the active views in the view tree.

Sometimes I need to get access to a specific view (View window, Global Table, GUI, etc.) because I like to manipulate something.

But because on one hand all ortho views are called ‘ortho’ it is not easy to identify the right one. Same with persp by the way.
On the other hand a Global Table might have the name GlobalTable Parameters119356104, but if I open it the next time it might be GlobalTable Parameters119359096.
So how can I refer to the one I want?

I know, that I can search through the views to find the first or the last ortho, but still I do not know which one is the right one I was looking for.

I am not sure what might be a good solution for this and this is why I opened this thread.

My first idea would be that the ortho should be called by the windowtitle (Standard: Orthographic View - 1 - model). So the user can change the title and can refer by name, if this is possible during open the view.
For the GlobalTable I would use a name like GlobalTableTableName (GlobalTableMyParameters).

I am not sure what to do with things like User Commands (How much sense does it make to have it twice open?) or with other windows.

I hope you got the issue I have and I am pretty sure that you guys will find a good solution for this.

Or there is already one and I just did not know.

Take care
tom the (A)tom

P.S.: I also did not find a way how I could manipulate the column size of a Global Table if I like to have different width for each column. Does not matter if the Global Table is open (active) or closed (not active). Am I right, that the column width is just one main parameter for all columns of this table?
I know that if I put the table in a GUI I can manipulate the width with the node cellwidth, but what if I do not want to use a GUI?

Tom David
11-20-2007, 07:52 AM
Okay, my P.S. issue I can now answer by myself :p.

It the same way as it can be done in the GUI.
Just put under the node cellwidth some additional nodes, make the nodes number nodes and put a value into it. The value is the width of the cell. The first node is for the first column, the second for the second, and so on.

I have no idea why I have overseen this the first time, because I was searching for it. Maybe I confused myself by all the posts I posted today ;).

Cliff King
11-20-2007, 01:17 PM
Tom,

A discussion regarding the management of active windows in Flexsim comes up a lot around here. We realize it can be a challenge to manage all the windows available to you in Flexsim. In the next major release we hope to redesign the windowing interface to be more windows-like, more like a tabbed interface similar to Visual Studio. Anthony has did some experimenting with this a couple months back and had some real success. I just added a request item (ID# 413) to the Flexsim future development list regarding this point. Please feel free to add comments to the item regarding specific interface improvements you desire as part of this initiative.

Kris Geisberger
11-22-2007, 09:41 AM
I recently desired to obtain a reference to the highlighted object in the most active view window FROM another object's GUI. In the end I made an assumption that the user was working in the last model view window that was open previous to the object GUI itself. (not the greatest assumption to make)

Because the orthographic and perspective views are renamed, I used a comparetext for "ortho" or "persp". However, I understand that that this would not work if I had of needed a reference to a different type of window like Tom.

This is the code in the OnPress of the button in the object's GUI. Is there a better way?

setcurrent(prev(ownerview(c)));
while(objectexists(current) && comparetext(getname(current),"Main Panel")==0)
{ if(comparetext(getname(current),"ortho") || comparetext(getname(current),"persp"))
{
setitem(selectedobject(current)); //hopefully another flowitem in the model
setcurrent(rank(node("@>objectfocus+",c),2)); //target item
if(objectexists(item) && comparetext(getname(node(">1",item)),"itemtype") && item!=current) //only if it is a flowitem
{
nodefunction(node("@>objectfocus+>labels/targeton/matchobjects",c), current, item); //my secret node function ;)
}
repaintall();
return 0;
}
setcurrent(prev(current));
}

AlanZhang
11-22-2007, 11:41 AM
Hi Tom and Kris,

If you want to get a specific view under the active view, I can think of two ways.

The first way is to comprare the window title with your specific window title. The code would be something like this:

treenode activeViews = node("/active",views());
for(int i=1;i<=content(activeViews);i++){
string winTitle=getviewtext(rank(activeViews,i));
if(stringsearch(winTitle,"Orthographic View - 1")!=-1){
pt("Found window ");pt(winTitle);pr();
// Do whatever you want here
}
}
The second way would be when you create a view, using somecode to explicitly set the name of that view (for example, "ortho1"). Then later you can use node("/active/ortho1",views()) to directly refer that node.

Best wishes,
Alan