sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Toolbar-command issue

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 446 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      bluetale
      last edited by

      hey

      I have a strange problem with my toolbar on mac-systems. I use command-objects for providing menu and toolbar-entries.
      In my plugin I have 3 "views" and they behave "radiobutton-like", so only one can be pressed.
      I use the .set_validation_proc method where I set the current "view" to MF_GRAYED and the other two to MF_ENABLED.

      Everything works as expected on windows-systems (menu and toolbar behaviour), but not on mac-systems.
      On mac the menu works fine, but the toolbar-buttons keep grayed instead of beeing enabled when I press on one of the other buttons. So after pressing on each button, they are all grayed. (only the toolbar)

      I have 3 internal modes: "standard", "building", "zones"

      	
      cmdStandard.set_validation_proc {
      		model = Sketchup.active_model
      		mat_dict = model.attribute_dictionary("my_dictionary", true)
      		
      		if mat_dict["mode"] == nil || mat_dict["mode"] =="standard" then
      			MF_GRAYED
      		else
      			MF_ENABLED
      		end
      }
      

      cmdStandard is my default-view-command. "standard"-mode is default and so the button and menu-entry is grayed.

      cmdBuilding.set_validation_proc {
      		model = Sketchup.active_model
      		mat_dict = model.attribute_dictionary("my_dictionary", true)
      		
      		if mat_dict["mode"] == nil || mat_dict["mode"] == "standard" then
      			MF_ENABLED
      		else
      			if mat_dict["mode"] == "building" then
      				MF_GRAYED
      			else
      				MF_ENABLED
      			end
      		end
      	}
      

      cmdBuilding is the command for one of the other two views. They should be enabled if the plugin is in "standard"-mode. The zone-command is the same as cmdBuilding but checks for "zone" instead of "building".

      I don't know what I should do to get the same behaviour as on windows-systems?

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        I think you need to use MF_CHECKED for the active item, and MF_UNCHECKED (or MF_ENABLED ) for the other two.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • B Offline
          bluetale
          last edited by

          @dan rathbun said:

          I think you need to use MF_CHECKED for the active item, and MF_UNCHECKED (or MF_ENABLED ) for the other two.

          I tried it, but it did not work. Is there a way to get a radiobutton-like behaviour of toolbar-buttons?

          I try to explain how I want to use my buttons:
          My first button (standard) represents the default view, every face looks normal.

          When the second button (building) is clicked, the color of every face is set back to the default color. The user can now use the paint-bucket to select the parts of the building he want to export later. After clicking on one of the other buttons the parts representing the building are stored and the original colors are restored.

          When the third button (zone) is clicked, the color of every face is set back to the default color. Now the user can use different colors with the paint-bucket to group the parts of the building. After clicking on one of the other buttons the grouping is stored and the colors are restored.

          So there is no need to implement every button as a tool. The annoying thing is that everything works fine with the windows-version. Is there a way to get such a behaviour as explained above for the mac-version?

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @bluetale said:

            @dan rathbun said:

            I think you need to use MF_CHECKED for the active item, and MF_UNCHECKED (or MF_ENABLED ) for the other two.

            I tried it, but it did not work. Is there a way to get a radiobutton-like behaviour of toolbar-buttons?
            ..snip...
            Is there a way to get such a behaviour as explained above for the mac-version?

            There may be a bug in the Mac version.
            I see this issue has been discussed in more detail in your more recent topic:

            Toolbar Win vs Mac
            http://forums.sketchucation.com/viewtopic.php?f=180&t=32626

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement