Here is another wonderful idiosyncrasy that is causing me trouble. I have a synchronous JLink application that creates a menu and button on start up. The button will open a Dialog box that displays all of the models that are currently in the session.
The maddening thing about this is the first time I try to open the dialog box it opens behind ProE. If I want to see the box I have to shrink the ProE window ahead of time so that I can click on it when it pops up. This only occurs the first time I open the dialog box. Afterwards the dialog will open on top of the ProE window. Any suggestions?
WF 3.0
XP Pro
Edited by: fiebigc
The maddening thing about this is the first time I try to open the dialog box it opens behind ProE. If I want to see the box I have to shrink the ProE window ahead of time so that I can click on it when it pops up. This only occurs the first time I open the dialog box. Afterwards the dialog will open on top of the ProE window. Any suggestions?
Code:
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcCommand.*;
public class proeSyncJDialog
{
public static Session curSession;
private static UICommand cmd;
public static void start() throws jxthrowable
{
curSession = pfcGlobal.GetProESession(); //Get Current Session Info
curSession.UIAddMenu("NeatoMenu", "Help", "proetext.txt", null); //Adds Neato! Menu Button
cmd = curSession.UICreateCommand("List Models In Session", new proeSyncJDialogListener(curSession)); //Creates Command to Open Web Page in Internal Browser
curSession.UIAddButton(cmd, "NeatoMenu", null, "SubMenuName1", "HelpMessage1", "proetext.txt"); //Creats Sub Menu Button to Open Web Page
}
public static void stop() //Stop Method Required by J-Link
{
}
}
Code:
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcCommand.*;
import com.ptc.pfc.pfcModel.*;
import javax.swing.*;
public class proeSyncJDialogListener extends DefaultUICommandActionListener
{
Session curSession;
public proeSyncJDialogListener (Session session)
{
this.curSession = session;
}
public void OnCommand() throws jxthrowable
{
Models modelsInSession = curSession.ListModels (); //Retrieves all models in session
String nameOfModels = ""; //Initialize String
if(modelsInSession.getarraysize() == 0)
nameOfModels = "No Models Present";
else
{
nameOfModels = modelsInSession.get(0).GetFullName();
if(modelsInSession.getarraysize() > 1)
for(int i=1; i<modelsInSession.getarraysize(); i++)
{
nameOfModels = nameOfModels + "\n" + modelsInSession.get(i).GetFullName();
}
}
JOptionPane.showMessageDialog(new JFrame(), nameOfModels, "Models in Session", JOptionPane.INFORMATION_MESSAGE);
}
}
WF 3.0
XP Pro
Edited by: fiebigc