This project is read-only.

Code Change: Visibility of Controls on a per-control basis

Jan 8, 2012 at 3:48 AM
Edited Jan 8, 2012 at 3:52 AM

I have created a small change (it's only a few lines of code) that lets me turn off rendering for certain controls. I did this because I want Nuclex to handle positioning and events, but I want to draw the controls myself. That said, some controls I want to let Nuclex render - like labels.

As such, I decided it would be best if controls simply had a .IsVisible property and thus I added to the code and am reporting the change back here. I made a WinMerge report of the two files I had to modify ... I'm just trying to find a place to upload that to this discussion.

Edit: Since attachments seem to be unsupported, I put them on my Web Site. Here are the links:

For FlatGuiVisualizer:

for Controls.cs:

Jan 10, 2012 at 9:58 AM

I'm curious why you need that. I imagine switching between drawing things yourself and letting the GUI draw could mess up the Z order.

If it's just for some render target controls, I'd probably have gone for a derived control class with a custom control renderer and a small extension to the FlatGuiGraphics class :)

Jan 11, 2012 at 4:58 AM

I need it because the controls don't allow me to reskin them on a per-control basis unless I want to create a new "control" subclass for each new skin. I want for example, menu buttons with custom graphics for each button. By turning them off in the manner I have, I can use Nuclex to control all the functionality and then query Nuclex for the coordinates to sprite batch the controls to get what I want.

And z-order on invisible controls isn't important.