cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

JLink error on Table setText

BrianKrieger
10-Marble

JLink error on Table setText

I have a set of code that essentially clears the contents of a cell.
This works in asynchronous mode but not in Sync. I'm just stumped.
Everything is the same, basically a session is created, the current
model is retrieved, detects that it's a drawing then collects two tables
and clears contents on two rows.



I've narrowed it down, I think, to an empty cell. Cell 1 is empty. If
I start with cell 2 (which has contents), all is right. If I start with
cell 1, error. Again, error only occurs in synchronous mode, async
works fine.



Any by some remote chance run into an issue like this with tables or
point me in a "d'oh!" direction?



I attached the full class for funsies (as my Thermo prof would say).



Thanks!

Brian Krieger



(comments removed)

private void clearCellContents(Table tableIn, int rowIn){

try{

stringseq emptyString = stringseq.create();

emptyString.append(");

for(int loopCells = 1;loopCells<6;loopCells++){

tableIn.SetText(pfcTable.TableCell_Create(rowIn,
loopCells), emptyString);

}

}

catch(jxthrowable e){

JOptionPane.showMessageDialog(null, "Problem clearing
contents.");

}

}







2 REPLIES 2

Brian -

It's possible that JLink contains a bug which cause inconsistent behavior
between Synchronous and Asynchronous modes - they are different libraries,
after all. The first Pro/Toolkit bug I ever identified existing only in
Windows synchronous DLL mode, not EXE mode.

Have you tried using a debugger against this code, by the way? Doing that
would might bring you identify problems you're not yet aware of.

> I’ve narrowed it down, I think, to an empty cell. Cell 1 is empty.
> If I start with cell 2 (which has contents), all is right.

If I understand this correctly, your code is failing when you try to clear
a cell that's already empty. I agree that you should report such a bug to
PTC once you confirm it. At the same time, could you work around this by
reading the cell content and clearing it only if it's not empty already?

|+| M a r k |+|

Mark Stallard
Rapid Response Development
information Solutions
Integrated Defense Systems
Raytheon Company




(business)
+1.978.436.6016
(cell)
+1.617.331.5443
(tie line)
239.6016

-



880 Technology Drive
Billerica, MA 01821
www.raytheon.com


Raytheon Sustainability

This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this message
in error, please so advise the sender by reply e-mail and delete this
message. Thank you for your cooperation.









Brian,
From your description a simple check to do nothing if the cell already is empty might by an easy workaround.
An empty cell might return a NULL object that is handled in async mode but not in sync mode.


In Reply to Brian Krieger:


I have a set of code that essentially clears the contents of a cell.
This works in asynchronous mode but not in Sync. I'm just stumped.
Everything is the same, basically a session is created, the current
model is retrieved, detects that it's a drawing then collects two tables
and clears contents on two rows.



I've narrowed it down, I think, to an empty cell. Cell 1 is empty. If
I start with cell 2 (which has contents), all is right. If I start with
cell 1, error. Again, error only occurs in synchronous mode, async
works fine.



Any by some remote chance run into an issue like this with tables or
point me in a "d'oh!" direction?



I attached the full class for funsies (as my Thermo prof would say).



Thanks!

Brian Krieger



(comments removed)

private void clearCellContents(Table tableIn, int rowIn){

try{

stringseq emptyString = stringseq.create();

emptyString.append(");

for(int loopCells = 1;loopCells<6;loopCells++){

tableIn.SetText(pfcTable.TableCell_Create(rowIn,
loopCells), emptyString);

}

}

catch(jxthrowable e){

JOptionPane.showMessageDialog(null, "Problem clearing
contents.");

}

}












Bjarne Frandsen

(Pro/ENGINEER Wildfire 4.0 M170andWindchill 9.1M060 on Windows)

Announcements


Top Tags