Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SKILL Q: enable form field dynamically

709 views
Skip to first unread message

Bernd Fischer

unread,
Jan 20, 2004, 11:34:49 AM1/20/04
to
Hi,

I want to enable disable a button box form field
dynamically depending on the value of a cyclic field
of the same form.
Something similar to the snipped code attached, but this does not
work! Any ideas?

FYI the form was only created once.

Thanks Bernd


l_windowSetupFields =
tconc(
l_windowSetupFields
list(
hiCreateCyclicField(
?name 'r_layoutWindowField
?choices cons( "New" l_layoutWindowIdList )
?prompt "Layout window"
?value "New"
)
( x_xInitalPos:( x_yInitalPos + 40 ) )
( x_setupFieldWidth:25 )
160
)
)

l_windowSetupFields =
tconc(
l_windowSetupFields
list(
hiCreateButtonBoxField(
?name 'r_createField
?prompt " "
?choices '( " Create " )
?callback list( "printf( \"DEBUG\" )" )
?enabled
hiGetCurrentForm( )~>r_tabField~>page1~>r_layoutWindowField->value == "New"
)
( ( x_xInitalPos + 280 ):( x_yInitalPos + 40 ) )
( 100:25 )
10
)
)

Bernd Fischer

unread,
Jan 20, 2004, 11:54:31 AM1/20/04
to
A more usable (cut and paste example).

It can not be creating the form every time new
when the cyclic field value has changed to
enable/disable the button box field?

Bernd


procedure( BFcreateTestForm( )
let( ( r_testCyclicField r_testButtonBoxField )

r_testCyclicField =
hiCreateCyclicField(
?name 'r_testCyclicField
?choices list( "One" "Two" )
?prompt "Test Cyclic Field"
?value "One"
)

r_testButtonBoxField =
hiCreateButtonBoxField(
?name 'r_testButtonBoxField
?prompt " "
?choices list( " Test " )
?callback list( "printf( \"This si a test.\" )" )
?enabled GBtestForm->r_testCyclicField->value == "One"
)

hiCreateAppForm(
?name 'GBtestForm
?formTitle "Test"
?fields list( r_testCyclicField r_testButtonBoxField )
)

)
)


procedure( BFdisplayTestForm( )

unless( boundp( 'GBtestForm ) && GBtestForm
BFcreateTestForm( )
)

hiDisplayForm( GBtestForm )

)

Diva Physical Verification

unread,
Jan 20, 2004, 2:14:10 PM1/20/04
to
You should look at hiEnableFormButton() and hiSetFieldEnabled(). I've
not used them yet, but I am told these will do what you want.

Pete nospam Zakel

unread,
Jan 20, 2004, 2:17:42 PM1/20/04
to
In article <400D58A9...@xignal.de> Bernd Fischer <bernd....@xignal.de> writes:
>I want to enable disable a button box form field
>dynamically depending on the value of a cyclic field
>of the same form.
>Something similar to the snipped code attached, but this does not
>work! Any ideas?

Your ?enabled value is evaluated once, at the time the create field code is
evaluated, so of course it doesn't work dynamically.

You need to use the value change callback of the one field to enable/disable
the other field.

-Pete Zakel
(p...@seeheader.nospam)

It's a funny thing - you work all your life toward a certain goal
and then somebody moves the posts on you.

- Herb Caen

Andrew Beckett

unread,
Jan 20, 2004, 5:33:18 PM1/20/04
to
Bernd,

You need to use a callback and invoke hiSetFieldEnabled() to change the
enabled field. In your code the ?enabled flag is only set at the time of
form creation.

Here's an example update.

Andrew.


procedure( BFcreateTestForm( )
let( ( r_testCyclicField r_testButtonBoxField )

r_testCyclicField =
hiCreateCyclicField(
?name 'r_testCyclicField
?choices list( "One" "Two" )
?prompt "Test Cyclic Field"
?value "One"

?callback "BFtestCyclicFieldCB(hiGetCurrentForm())"


)

r_testButtonBoxField =
hiCreateButtonBoxField(
?name 'r_testButtonBoxField
?prompt " "
?choices list( " Test " )
?callback list( "printf( \"This si a test.\" )" )

?enabled t


)

hiCreateAppForm(
?name 'GBtestForm
?formTitle "Test"
?fields list( r_testCyclicField r_testButtonBoxField )
)

)
)


procedure( BFdisplayTestForm( )

unless( boundp( 'GBtestForm ) && GBtestForm
BFcreateTestForm( )
)

hiDisplayForm( GBtestForm )

)

procedure(BFtestCyclicFieldCB(form)
hiSetFieldEnabled(form->r_testButtonBoxField
form->r_testCyclicField->value=="One")
)

On Tue, 20 Jan 2004 17:54:31 +0100, Bernd Fischer <bernd....@xignal.de>
wrote:

>A more usable (cut and paste example).

--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd

Bernd Fischer

unread,
Jan 21, 2004, 5:20:39 AM1/21/04
to
Hi Guys,

Thanks, of course the callback does the trick,
this was also my overnight thought.

Bernd

0 new messages