Hey J-link peeps!
the question of the day is how to activate the window of a newly open
drawing. this does not seem to work:
window.Activate();
window.Repaint();
I was wonderin if I did a
curSession.OpenFile(file name);
could i do a
window.Activate(file name);
thanks for the help!
regards,
Alfonso
import java.awt.*;
import javax.swing.*;
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcModel.*;
import com.ptc.pfc.pfcSelect.*;
import com.ptc.pfc.pfcWindow.*;
public class OpenDraw{
private static Session curSession=null;
private static Model model=null;
private static String modelName=";
private static ModelDescriptor descr;
private static ModelType
modTyp=com.ptc.pfc.pfcModel.ModelType.MDL_DRAWING;
private static SelectionOptions selectionOptions;
private static Selections selections;
private static com.ptc.pfc.pfcWindow.Window window;
static Frame pfcFrame = new Frame();
public static void start (){
try{
curSession = pfcGlobal.GetProESession();
model=curSession.GetCurrentModel();
modelName=model.GetInstanceName();
descr = pfcModel.ModelDescriptor_Create (modTyp, modelName, null);
curSession.OpenFile(descr);
//curSession.GetCurrentWindow();
com.ptc.pfc.pfcWindow.Window window =
curSession.GetCurrentWindow();
// This activate window does not work at all
window.Activate();
window.Repaint();
mes("Here is the drawing you wanted");
selectionOptions = pfcSelect.SelectionOptions_Create("dwg_table");
selections = curSession.Select(selectionOptions, null);
}
catch (jxthrowable jxth){
mes("cannot_find the file dummy!");
jxth.printStackTrace ();
}
stop();
}//end start
//=========================================================================
public static void stop (){
}
//=========================================================================
private static void mes(String message){ //Pop-op boks
JOptionPane.showMessageDialog ( pfcFrame, message,
"Message from Jlink!", JOptionPane.INFORMATION_MESSAGE );
}//end mes
}