View Full Version : Overriding variable behaviour
lcsoft
12-13-2004, 08:26 AM
Hello,
I've a browser that displays a tree with the groups as nodes and the parts as leafs (as the Structure tree). When I single click a part, a dialog is opened(this dialog is callable also by another widget). My problem is that this dialog has a variable with :part-assembly type so it displays the active part and not the part I have clicked in the browser.
This is a piece of the code from the dialog:
CUT
:variables
'(
(part
:value-type :part-assembly
:modifies :contents
:title "Part/Group"
:prompt-text "blabla"
:after-input
CUT
and this is the way I call the dialog from the single click event:
(defun single-click (object name)
(sd-call-dialog "ATTRIBUTES"
:ref-control "MENU"
:parent-shell *dirbrowser-tree*
:attachment :bottomcenter
;:x-offset offset
;:y-offset offset
)
)
How can I fill the variable "part" with the current clicked node/leaf ? Thank you.
dorothea
12-13-2004, 09:53 PM
Hi,
I have no complete solution but some notes:
In the documentation for the sd-call-action you find the following:
dialog {STRING} - The dialog to be called with optional additional parameters
=> This measn that you can pass the necessary parameter after the dialog name. In your case it should be something like: (sd-call-dialog "ATTRIBUTES :part <pathname>" ....
where <pathname> is the name of the selected object or the sel_item.
How do you get this information? This depends in the structure you've build with your browser. The single click action gets as parameter the selected node/leave. You have to extract the information out of this node.
Hope this helps,
Dorothea
lcsoft
12-14-2004, 06:29 AM
In your case it should be something like: (sd-call-dialog "ATTRIBUTES :part <pathname>" ....
where <pathname> is the name of the selected object or the sel_item.
Hello, many thanks for this hint!
I'm trying to do this:
(defun single-click (object name)
(sd-call-dialog "LC_OMS_ATTRIBUTI :part 'object"
:ref-control *dirbrowser-tree*
:parent-shell *dirbrowser-tree*
:attachment :bottomcenter
;:x-offset offset
;:y-offset offset
)
)
where the part variable is defined as :part-assembly:
(sd-defdialog 'LC_OMS_ATTRIBUTI
:dialog-title "Parts"
:start-variable 'part
CUT
:variables
'(
(part
:value-type :part-assembly
:modifies :contents
:title "Part"
and the bind for the click action is made in the browser in this way
(sd-browser-click-action *dirbrowser-tree*
:action-type :single-click
;:mask '(:shift)
:mask nil
:button :button1
:action-func 'single-click
)
But I get this error: "You have specified an unexpected input value."
Have you any other hint? ;) Thank you.
dorothea
12-14-2004, 07:05 AM
Hi,
Do you know what what kind of data is the parameter object you get passed to the single click action?
If you don't know just print it for testing. It's a browser node and the dialog wants to have either part or assembly. Therefore you get the error message.
Please check the documentation of sd-browser-click-action (the section about the examples) and the BrowserNode documentation. There you can see how to get the pathname out of the browser node (the object). Just add a quote (') before the variable doesn't do the necessary job.
I think you have to call something like that:
(BrowserNode-objPname object)
(defun single-click (object name)
(sd-call-dialog (format nil "LC_OMS_ATTRIBUTI :part ~s" (BrowserNode-objPname object))
:ref-control *dirbrowser-tree*
:parent-shell *dirbrowser-tree*
:attachment :bottomcenter
;:x-offset offset
;:y-offset offset
)
)
But it really depends on the structure of your browser nodes.
Dorothea
lcsoft
12-14-2004, 08:27 AM
Many thanks Dorothea!
Now my functions is:
(defun single-click (object name)
(setq pathtemp (subseq (format nil "~A" (browsernode-objpath object)) 5))
(sd-call-dialog (format nil "LC_OMS_ATTRIBUTI :part ~s" (sd-pathname-to-obj pathtemp))
:ref-control *dirbrowser-tree*
:parent-shell *dirbrowser-tree*
:attachment :bottomcenter
;:x-offset offset
;:y-offset offset
)
)
and it works!
Thanks again! :)
vBulletin® v3.8.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.