Avoid displaying two Forms of same function

B

BUS

Guest
Hello all,
I want to avoid displaying a form if it is already active generated
by a user defined function.
For this I tried using

if(hiIsFormDisplayed(testform)==t
then
printf("testform is already displayed")
else
hiDisplayForm(testform list(0 0))
)

But this is not working as the formstructure is modified for every
new run.
What is the approach to stop displaying a form if it is already
displayed .


Regards,
Sridhar.
 
BUS wrote, on 11/09/09 11:31:
Hello all,
I want to avoid displaying a form if it is already active generated
by a user defined function.
For this I tried using

if(hiIsFormDisplayed(testform)==t
then
printf("testform is already displayed")
else
hiDisplayForm(testform list(0 0))
)

But this is not working as the formstructure is modified for every
new run.
What is the approach to stop displaying a form if it is already
displayed .


Regards,
Sridhar.
Not entirely sure what you're after, but maybe you want to call
hiFormCancel(formId)?

Regards,

Andrew.
 
Hello Andrew,

My point is that
The below function testform() when executed opens the form "TestForm".
If I execute the function testform() onceagain one more form
"TestForm" is displayed.
While already a "TestForm" is open.
Now here I want to avoid displaying "TestForm" if itis already open
even though testform() function is executed.
How can I do this.
I am using the condition if(hiIsFormDisplayed(testform)==t but its not
working.


;Starts here
procedure(testform()
broname=list("Schematic Library" "Cell" "View" "Layout Library" "Cell"
"View")
testtable=makeTable("browse")
for(Count 1 5
bronamet=nth(Count-1 broname)
testtable[Count]=hiCreateStringField(?name gensym('b)
?prompt bronamet
)
)
testform=hiCreateAppForm(?name gensym('testform)
?formTitle "TestForm"
?fields list(testtable[1] testtable[2] testtable[3] testtable[4]
testtable[5])
?buttonLayout 'Close
)
if(hiIsFormDisplayed(testform)==t
then
printf("Already **TestForm is Open**")
else
hiDisplayForm(testform list(0 0))
)
);procedure
;Ends here
 
Hi Sridhar,

It is said in the 'CadenceŽ User Interface SKILL Functions Reference'
that it is necessary to use a unique global SKILL symbol as the SKILL
handle in the creation of a form. you however have used thhe gensym()
function to create the handle. The gensym() creates a new symbol each
time it is called. This is an example:
CIW> gensym('testform)
testform24
CIW> gensym('testform)
testform25

So as you can see above, a new symbol was created and that makes your
test condition failing. You better look at the gensym() documentation
for a better understanding.
Anyway, I have done a minimal update on your code that makes it
running as you wanted.
Cheers,
Riad.

procedure(testformCreateForm()
broname=list("Schematic Library" "Cell" "View" "Layout Library" "Cell"
"View")
testtable=makeTable("browse")
for(Count 1 5
bronamet=nth(Count-1 broname)
testtable[Count]=hiCreateStringField(?name gensym('b)
?prompt bronamet
)
)
hiCreateAppForm(?name 'testform
?formTitle "TestForm"
?fields list(testtable[1] testtable[2] testtable[3]
testtable[4]
testtable[5])
?buttonLayout 'Close
)
);procedure
;Ends here

procedure(testform()
unless(boundp('testform)
testformCreateForm()
)
hiDisplayForm(testform)
)
 
In article <3391923e-5d88-4c5a-923d-c696e9259450@k19g2000yqc.googlegroups.com> BUS <sridhartv25@gmail.com> writes:
Hello all,
I want to avoid displaying a form if it is already active generated
by a user defined function.
For this I tried using

if(hiIsFormDisplayed(testform)==t
then
printf("testform is already displayed")
else
hiDisplayForm(testform list(0 0))
)

But this is not working as the formstructure is modified for every
new run.
What is the approach to stop displaying a form if it is already
displayed .
If the form is already displayed, calling hiDisplayForm() will simply raise
the form, so it's probably the right thing to do.

Are you trying to avoid recreating the form if it has already been created?

-Pete Zakel
(phz@seeheader.nospam)

"The first rule of intelligent tinkering is to save all the parts."

-Paul Erlich
 
In article <66df4fb8-7c94-4344-9f45-ca0bb0946efd@j19g2000yqk.googlegroups.com> BUS <sridhartv25@gmail.com> writes:
Hello Andrew,

My point is that
The below function testform() when executed opens the form "TestForm".
If I execute the function testform() onceagain one more form
"TestForm" is displayed.
While already a "TestForm" is open.
Now here I want to avoid displaying "TestForm" if itis already open
even though testform() function is executed.
How can I do this.
I am using the condition if(hiIsFormDisplayed(testform)==t but its not
working.


;Starts here
procedure(testform()
broname=list("Schematic Library" "Cell" "View" "Layout Library" "Cell"
"View")
testtable=makeTable("browse")
for(Count 1 5
bronamet=nth(Count-1 broname)
testtable[Count]=hiCreateStringField(?name gensym('b)
?prompt bronamet
)
)
testform=hiCreateAppForm(?name gensym('testform)
?formTitle "TestForm"
?fields list(testtable[1] testtable[2] testtable[3] testtable[4]
testtable[5])
?buttonLayout 'Close
)
if(hiIsFormDisplayed(testform)==t
then
printf("Already **TestForm is Open**")
else
hiDisplayForm(testform list(0 0))
)
);procedure
;Ends here

Your problem is you are checking after you've already created a new form
instead of before.

This is bad because you are reusing the same form symbol, so you are
essentially orphaning the previous form.

Just canceling and deleting the previous form won't work either, unless you
specify the form is non-blocking (argument "?dontBlock t" to hiCreateAppForm())
so that would be bad.

If the form contents is not going to change, then simply create the form once,
and then display it whenever necessary. If the form contents changes, then
you can use hiDelteteField(s)() and hiAddField(s)() to update it.

-Pete Zakel
(phz@seeheader.nospam)

"If you need this kind of efficiency in your life, you should get a computer.
I recommend the kind I have, which is a `DOS' computer. (`DOS' is an
acronym, meaning `ROM'.) The other major kind of computer is the `Apple',
which I do not recommend, because it is a wuss-o-rama New-Age computer that
you just basically plug in and use. This means you don't get to participate
in the most entertaining aspect of computer-owning, which is trying to get
the computer to work. This is where `DOS' really shines. It is way beyond
normal human comprehension."
-Dave Barry
 
Note that in my response below I missed the fact that you were using gensym().
The code that someone else posted deals with that.

-Pete Z.

In article <4af9c1f5$1@news.cadence.com> pxhxz@cadence.com (Pete nospam Zakel) writes:
In article <66df4fb8-7c94-4344-9f45-ca0bb0946efd@j19g2000yqk.googlegroups.com> BUS <sridhartv25@gmail.com> writes:
Hello Andrew,

My point is that
The below function testform() when executed opens the form "TestForm".
If I execute the function testform() onceagain one more form
"TestForm" is displayed.
While already a "TestForm" is open.
Now here I want to avoid displaying "TestForm" if itis already open
even though testform() function is executed.
How can I do this.
I am using the condition if(hiIsFormDisplayed(testform)==t but its not
working.


;Starts here
procedure(testform()
broname=list("Schematic Library" "Cell" "View" "Layout Library" "Cell"
"View")
testtable=makeTable("browse")
for(Count 1 5
bronamet=nth(Count-1 broname)
testtable[Count]=hiCreateStringField(?name gensym('b)
?prompt bronamet
)
)
testform=hiCreateAppForm(?name gensym('testform)
?formTitle "TestForm"
?fields list(testtable[1] testtable[2] testtable[3] testtable[4]
testtable[5])
?buttonLayout 'Close
)
if(hiIsFormDisplayed(testform)==t
then
printf("Already **TestForm is Open**")
else
hiDisplayForm(testform list(0 0))
)
);procedure
;Ends here


Your problem is you are checking after you've already created a new form
instead of before.

This is bad because you are reusing the same form symbol, so you are
essentially orphaning the previous form.

Just canceling and deleting the previous form won't work either, unless you
specify the form is non-blocking (argument "?dontBlock t" to hiCreateAppForm())
so that would be bad.

If the form contents is not going to change, then simply create the form once,
and then display it whenever necessary. If the form contents changes, then
you can use hiDelteteField(s)() and hiAddField(s)() to update it.

-Pete Zakel
(phz@seeheader.nospam)

"If you need this kind of efficiency in your life, you should get a computer.
I recommend the kind I have, which is a `DOS' computer. (`DOS' is an
acronym, meaning `ROM'.) The other major kind of computer is the `Apple',
which I do not recommend, because it is a wuss-o-rama New-Age computer that
you just basically plug in and use. This means you don't get to participate
in the most entertaining aspect of computer-owning, which is trying to get
the computer to work. This is where `DOS' really shines. It is way beyond
normal human comprehension."
-Dave Barry
 
Thanks alot Riad and Pete Zakel for your answers.

Regards,
Sridhar.
 

Welcome to EDABoard.com

Sponsor

Back
Top