CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 09-26-2013, 06:17 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
icons in a graphical browser

Hi,

How is it possible to get the little icons next to a browsernode in a graphical browser. I can't find a command to do this, but it should be possible, because the structure browser has all kinds of icons in to it.

thanks in advance
greetings
Ruben
Reply With Quote
  #2  
Old 09-27-2013, 12:20 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
Re: icons in a graphical browser

After a bit of searching in google I found a solution with interrogators. So now I can place an icon next to the browsernodes in my new browser. But I still have a little problem, the icon is next to all the browsernodes instead of next to the selected one. How can I do this? My code is here below.

Code:
(in-package :mat)
(use-package :oli)
	
	(defvar *dirbrowser* "Materials")
	
	(defun dirbrowser-build-tree ()
		(setf parent 
			(sd-create-browsernode	:tree *dirbrowser*
									:parent nil
									:objPname "Materials")
		)
		(sd-create-browsernode  :tree *dirbrowser*
								:parent parent
								:objPname "Plate")
		(setf profile 
			(sd-create-browsernode  :tree *dirbrowser*
									:parent parent
									:objPname "Profile")
		)
		(sd-create-browsernode  :tree *dirbrowser*
								:parent parent
								:objPname "Round Bar")
		(sd-create-browsernode  :tree *dirbrowser*
								:parent parent
								: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)
	
	(sd-browser-add-interrogator 	*dirbrowser*
									:interrogator-type :primary-pixmap
									:interrogator-func 'functie)
								
	(defun functie (node name)
		(setf node (sd-get-browsernode-struct *dirbrowser* parent))
		(setf name (sd-browser-register-image	*dirbrowser*
												:image "create"
												:filename "C:/Users/rvn/Dropbox/Programming/1-lisps/bmp/create.bmp"
												:type :primary-image))
	)
Reply With Quote
  #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
  #4  
Old 10-17-2013, 10:58 PM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
Re: icons in a graphical browser

Hi Andy,

Thanks again for this, works great!

Greetings Ruben
Reply With Quote
  #5  
Old 04-13-2018, 06:06 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: icons in a graphical browser

Is it possible to associate to these icons a "change color part and density" command?

So if I click them and then click on the piece in the 3D window, will I change the color and density of the part?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:07 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.