View Single Post
  #3  
Old 09-27-2013, 08:48 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: icons in a graphical browser

Hi Ruben,

As I indicated in email, the reason you're seeing icons for all items is that the interrogator isn't actually checking anything -- it's just returning the name of the image to use. So you need to update that function. I've fixed that, and made a few other changes to clean up the code, and I have also added a few comments. I think this will do what you need:
Code:
(in-package :mat)
(use-package :oli)

(defvar *dirbrowser* "Materials")

;; create a couple of variables to hold our parent node and profile node
(defvar *parent-node* nil)
(defvar *profile-node* nil)

(defun dirbrowser-build-tree ()
  (setf *parent-node* (sd-create-browsernode	:tree *dirbrowser*
						:parent nil
						:objPname "Materials"))
  (sd-create-browsernode  :tree *dirbrowser*
			  :parent *parent-node*
			  :objPname "Plate")
  (setf *profile-node*	(sd-create-browsernode  :tree *dirbrowser*
						:parent *parent-node*
						:objPname "Profile"))
  (sd-create-browsernode  :tree *dirbrowser*
			  :parent *parent-node*
			  :objPname "Round Bar")
  (sd-create-browsernode  :tree *dirbrowser*
			  :parent *parent-node*
			  :objPname "Square")
  )

(defun dirbrowser-create ()
  (sd-destroy-browser-tree *dirbrowser*)
  (sd-create-browser-tree *dirbrowser* :update-func 'dirbrowser-build-tree)
  (sd-destroy-graphical-browser *dirbrowser*)
  (sd-create-graphical-browser
   *dirbrowser* :tree *dirbrowser* :createAsTab nil :tabname "Materials"
   :topLabel "Materials" :minHeight 400	:maxWidth 200 :maxHeight 1000
   :tabImage "C:/Users/rvn/Dropbox/Programming/1-lisps/bmp/create.bmp")
  (sd-show-graphical-browser *dirbrowser* :position '("task-ds" :lefbottom))
  )

(dirbrowser-create)
(dirbrowser-build-tree)

;; register the image when this file is loaded.  Then we can use it any time.
(sd-browser-register-image *dirbrowser*
			 :image "create"
			 :filename "C:/Users/rvn/Dropbox/Programming/1-lisps/bmp/create.bmp"
				:type :primary-image)

(defun functie (node name)
  ;; only return "create" when the node is the parent node
  (when (string= (browsernode-nodeid node) *parent-node*)
    "create"))

(sd-browser-add-interrogator 	*dirbrowser*
				:interrogator-type :primary-pixmap
				:interrogator-func 'functie)
I hope this helps!

andy
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+!
See them in action at www.ai-maxtools.com and then try them for yourself -- FREE!
Reply With Quote