Quantcast
Channel: Cadence Technology Forums
Viewing all articles
Browse latest Browse all 62949

Forum Post: RE: skill GUI radio button

$
0
0
The main problem with the code is that you were: Using oferExampleForm->ViaRadio->value and oferExampleForm->LayerRadio->value when you should have been using oferExampleForm->viaradio->value and oferExampleForm->layerradio->value (you need to use the field names not the variable names) - because of this, your callbacks weren't seeing the value of the radio buttons You also had the wrong field names when you created the oldVia and newVia fields in the via radio callback (you created them with these variables, but the field names were oldLayer and newLayer, so would have clashed with the fields added by the layer radio callback) Your code is a bit messy and has a number of problems which I didn't fix - I'll leave that to you so that you can learn from it (I only fixed the basic flaw above): Total lack of indentation made it very hard to follow (so I partly re-indented it so I stood some chance of debugging it) You have the dynamically added fields being created in the callback functions, so they are recreated every time the callback is triggered, which I doubt is what you want. Rather than doing that, perhaps you should create them in the main function and then store them in a disembodied property list for use later (you're storing them in a DPL in the callbacks but not using it anywhere, so that code is a bit redundant) You are creating the oldVia/newVia/oldLayer/newLayer fields as global variables since they are outside a let. The logic is wrong - if you click Copy or Replace and then go back to "none" it leaves one of the fields behind. You have to click on Copy, then Remove, then none to make them go away. Your function names are a bit weird. Obviously you've started from my "oferExample" code but unless you happen to be called "Ofer" (the original example was written for somebody in Israel called Ofer), I can't see why you've kept those function prefixes, or why you have a function called "Form" which is not very likely to be unique. Anyway, here's the code with the first level of fixes done (and see how much easier it is to follow with indentation!): procedure(Form() let((libName LayerRadio ViaRadio sep1 sep2) libName=hiCreateStringField( ?name 'libName ?prompt "Library Name" ?callback "ddsUpdateSyncWithForm()" ) sep1=hiCreateSeparatorField(?name 'sep1) LayerRadio=hiCreateRadioField( ?name 'layerradio ?prompt "Layer Options" ?choices list("Copy" "Replace" "Remove" "none") ?value "none" ?defValue "none" ?callback list("oferLayerRadioButtonCB()") ) sep2=hiCreateSeparatorField(?name 'sep2) ViaRadio=hiCreateRadioField( ?name 'viaradio ?prompt "Via Options" ?choices list("Copy" "Replace" "Remove" "none") ?value "none" ?defValue "none" ?callback list("oferViaRadioButtonCB()") ) hiCreateAppForm( ?name 'oferExampleForm ?formTitle "Ofer's example form" ?callback 'oferExampleForm ?fields list(libName sep1 LayerRadio sep2 ViaRadio) ) ); let ); procedure Form procedure(oferLayerRadioButtonCB() oldLayer=hiCreateStringField( ?name 'oldLayer ?prompt "old Layer" ) newLayer=hiCreateStringField( ?name 'newLayer ?prompt "new Layer" ) oferExampleForm->extraFields=list(nil 'oldLayer oldLayer 'newLayer newLayer) oferExampleForm let( (radioVal) ; field is called layerradio not LayerRadio radioVal=oferExampleForm->layerradio->value when(radioVal=="none" && oferExampleForm->oldLayer hiDeleteField(oferExampleForm 'oldLayer)) when(radioVal=="Remove" && oferExampleForm->newLayer hiDeleteField(oferExampleForm 'newLayer)) when(radioVal=="Copy" || radioVal=="Replace" || radioVal=="Remove" unless(oferExampleForm->oldLayer hiAddField(oferExampleForm oldLayer) ) ) when(radioVal=="Copy" || radioVal=="Replace" unless(oferExampleForm->newLayer hiAddField(oferExampleForm newLayer) ) ) ) ); procedure oferLayerRadioButtonCB procedure(oferViaRadioButtonCB() ; the field names where oldLayer and newLayer but should be oldVia and newVia oldVia=hiCreateStringField( ?name 'oldVia ?prompt "old Via" ) newVia=hiCreateStringField( ?name 'newVia ?prompt "new Via" ) oferExampleForm->extraFields=list(nil 'oldVia oldVia 'newVia newVia) oferExampleForm let( (viaradioVal) ; was using ViaRadio but the field is called viaradio viaradioVal=oferExampleForm->viaradio->value when(viaradioVal=="none" && oferExampleForm->oldVia hiDeleteField(oferExampleForm 'oldVia)) when(viaradioVal=="Remove" && oferExampleForm->newVia hiDeleteField(oferExampleForm 'newVia)) when(viaradioVal=="Copy" || viaradioVal=="Replace" || viaradioVal=="Remove" unless(oferExampleForm->oldVia hiAddField(oferExampleForm oldVia))) when(viaradioVal=="Copy" || viaradioVal=="Replace" unless(oferExampleForm->newVia hiAddField(oferExampleForm newVia) ) ) ) ); procedure oferViaRadioButtonCB procedure(BEOL() unless(boundp('oferExampleForm) Form() ) hiDisplayForm(oferExampleForm) ) Andrew

Viewing all articles
Browse latest Browse all 62949

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>