.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fixed size paletteset?

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
stefanveurink68AXD
610 Views, 10 Replies

Fixed size paletteset?

In the palletteset tool, is there a way to give the paletteset a fixed size?

 

I know the minimumsize but somehow when I open it in autocad the size of my palette is very weird, and can't figure out how to fix this. 

10 REPLIES 10
Message 2 of 11

You might need to provide more details about what you exactly want: do you want the PaletteSet Always to be fixed size (i.e. user cannot resize it, cannot dock it. If so, then it would defeat the purposes of using PaletteSet); or you only want it to be certain size when it becomes visible the first time (not docked; you probably do not want AutoCAD to remember its size/location, in this case)? Then I am wondering, why bother using PaletteSet? You can show a modeless window/dialog with fixed size easily.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 11

Indeed, I only want it to be a certain size when it becomes visible the first time. It now remembers some old settings (I can't remember I ever set those btw), even after restarting Autocad and netloading it again. And whatever I change at the size settings, the way it shows the first time doesn't change, it's still those old settings.  

 

Btw, a welcome feature from the paletteset is that you can still use autocad while seeing the form, this isn't possible (as far as I know) with the other options you called? We also got some external program running in Autocad (it's called Infracad), this is also fixed size, dockable, and autocad still available when opened, no tabs btw). I was looking for something like this). 

Message 4 of 11

1. If supply the PaletteSet's constructor a fixed GUID, AutoCAD will automatically remember the PaletteSet's position/size/dock/visible status. So, if you do not want AutoCAD to remember these things, you can choose not supply a fixed GUID to its constructor. Then when you show the PaletteSet, AFTER setting its Visible to true, you can also set its size. Something like

 

private static MyPalletSet _ps=null;

[CommandMethod("ShowMyPaletteSet", CommandFlags.Session)]

public static void ShowPaletteSet()

{

   if (_ps==null)

   {

      _ps=new MyPaletteSet(....);

   }

   _ps.Visible=true;

   __ps.Size=....;

}

 

2. The "welcome feature" you referred to is called "modeless" UI. As I mentioned in my previous reply, you can create your own modeless UI with WinForm/WPF. With WPF, you could easily create a  floating UI similer to PaletteSet (well, it is not easy to make it dockable, though). So, if you do not care docking and really want a fixed-size UI, you can do it without having to use PaletteSet (again, you'd better to use WPF).

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 11

Thanks, very clarifying. Docking is very welcome so I keep the palettes. 

 

 

Message 6 of 11

Just a side note, I made an app with a fixed sized palette, I handled the size event. It looked beautiful on my computer, then someone sent me a screen shot of my palette on their laptop, man it was hardly usable.

 

Use the PaletteSet with the GUID overload, let the user position the palette and the size will be persised in their profile… live and learn

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 7 of 11

Lol, yes I found this too, different resolutions give different results. Also consider the fact that the actual pallette is bigger then the form, else you also get strange results lol. However, Infracad did it (see: https://www.youtube.com/watch?v=TLX5w9GnSEA for the idea, this video isn't exactly infracad btw) so it IS possible. 

Message 8 of 11

Ah, yes, certainly possible for simple controls, this was my block manager, before Adsk made a better one. You could scroll through a directory and drag and drop blocks or drawings

 

Anyway, the size was hard coded, it was a total fail lol

 

Capture.PNG

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 9 of 11


@stefanveurink68AXD wrote:

Lol, yes I found this too, different resolutions give different results. Also consider the fact that the actual pallette is bigger then the form, else you also get strange results lol. However, Infracad did it (see: https://www.youtube.com/watch?v=TLX5w9GnSEA for the idea, this video isn't exactly infracad btw) so it IS possible. 


I don't get it. 

 

I watched the video, and it would appear that the control is designed to resize to fit its container. If the size of the container increases, the control and the child controls on it adjust accordingly (e.g., to fill the height and/or width of their container). What is so elusive about getting a UI to do that? I've built many dozens of Palette UIs that behave the same way, and never had a problem.

Message 10 of 11

I'm sorry, your right. It resizable, just as the one I actually meant (https://www.youtube.com/watch?v=tBbvk_1pTas), they just set up the form really smart in such a way it allways appears right (the position of controls is set with size as variable, like a dynamic winform). 

Message 11 of 11

In this post, you'll find some code that adds a user control with buttons on it to a PaletteSet, that behaves exactly the same way the paletteset in the video does. The OnLayout() override is what makes that happen (along with a few helper methods).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta