PDA

View Full Version : Clearing attributes displayed in dialog box


SoonTin
09-25-2003, 02:11 AM
Hello, I would like to know the code or function to clear the attributes displayed in the dialog box immediately after they are being detached from the part/model. Any help will be greatly appreciated.

dorothea
09-25-2003, 02:45 AM
Hello,

I have to ask some questions before I can answer.

What attributes do you mean?
Which dialog do you call which detaches attributes?
Do you mean the output box when talking about dialog box?

Dorothea

SoonTin
09-25-2003, 04:51 PM
Hello Dorothea,

Thank you for your response. The attributes are liked partno., description, material, etc. I have the same dialog box to attach and detach attributes to the model but after detaching (sd-detach-item-attribute) the detached attributes still stay on the dialog box as shown in the attachment.

dorothea
09-26-2003, 03:11 AM
Hi,

I'm still not hundred percent sure if I understood you right. But let me try to answer. Correct me if I'm wrong.

Did you write the dialog by yourself? How do you set the values displayed in the dialog fields for an attribute before you detach it from the part?

I think somehow the user selects the attribute which has to be deleted. How is this done? Then you call the sd-detach-attribute function in the dialog. After that you can 'reinit' the dialog variables. Assumed the part number is of type :number. Somebody has to display this value in the dialog field. The same way it can be removed again. For instance with (setf variable nil)

I know this is verry unspecific answer. But again I have to say, I need more information to answer in a better way.

Regards,
Dorothea

SoonTin
09-29-2003, 06:55 PM
Hello Dorothea,

The original dialog only allow attributes to be attached and I am modifying it to include function to detach the attributes. It is working fine except that I cannot have the dialog "REFRESH" to display the actual "status" of the model after the attributes are being detached as shown in the attachment.

I hope the explanation cum attachment help you to understand the problem a little better. Thank you.

dorothea
09-29-2003, 09:25 PM
Hello,

After the user pressed the 'Detach' button you call programmatically the attribute detach function. After that for user interface reinitialization set all the values to nil. This can be done with
(setf PART_NO nil)
where PART_NO is the name of the variable. Do this with every variable you want to reset.

I hope this is what you wanted to know!
Regards,
Dorothea

SoonTin
09-29-2003, 10:51 PM
Hi Dorothea,

I am actually expecting a single line code to handle the "REFRESH" function but it looks like the variables have to be manually reset individually per the conventional way. Thank you once again for your kind assistance.

Best regards,
Soontin

Andy Poulsen
11-13-2003, 10:26 AM
Hi SoonTin,

If you're looking for a single call to set all the variables, you can combine them in either a (setq ... ) or (setf ... ). For example:

(setq VAR1 nil ;clears var1
VAR2 nil ;clears var2
...
)

I don't believe there is a function call that will automatically reset all dialog variables -- the risk of unexpected behavior could be pretty high.

You could also write a function for the :local-functions section of your dialog that does what you want, and then just call it from your Detach function.

However, doing what has been discussed so far doesn't necessarily do what you want. You mentioned that after you detach the attributes, you want to display the ACTUAL status of the model. If an attribute was not detached successfully, the above methods will not give you any indication of failure.

To avoid this problem, you can check the return value of (sd-detach-item-attibute) to make sure it succeeded and proceed accordingly.

Alternatively (and this may be the best solution), create a function (for example called update-vars) in the :local-functions section that will query the object in question for attributes and update all the related fields of your dialog. This way, when you enter the dialog, you call this function to show the current values of all attributes. After you have called the "Detach" function, call the (update-vars) function again, which will display the ACTUAL values of the attributes (or will display nothing if the attributes were successfully detached).

Best of luck!

asp

SoonTin
11-16-2003, 06:21 PM
Hi Andy, thank you for your suggestion. I will give it a try.
Best regards, SoonTin