Jump to content

OptionBasedLibrary Development

Recommended Posts

For future reference:


I want to ask though, and I think the answer is no, but does OptionBasedLibrary supports dynamic gui? As in I'm able to hide UI elements or based on variables equation? It's the hiding part I want, not unselect-able.


For example:



u "{$1}"\



From $1 to $15 brackets (inside brackets are variables used by a filter.) are individual gui elements, and the _{$expression} is the conditions to hide elements. This, but in OptionBasedLibrary C# form. 0 means hidden, 1 means unselectable (not hidden), and 2 means visible and selectable.

Edited by Reptillian

G'MIC Filter Developer

Link to post
Share on other sites
6 hours ago, toe_head2001 said:

Here you go. I've named the files as OblTestBitmap.dll and OblTestSurface.dll.

You missed the .dlcs but empty ones are working fine. 😉

I'm getting exactly the same issues. No idea in the moment but I will check...

Link to post
Share on other sites
23 minutes ago, Reptillian said:

For future reference:

I take it as this. We will discuss it later.


In the moment you can just enable/disable OptionControls via the UI but you can not hide them. Hiding would require to update the layout.

You may derive your own Optioncontrols and maybe a PerformLayout of the dialog works. No idea in the moment.

Link to post
Share on other sites
10 hours ago, toe_head2001 said:

Here you go. I've named the files as OblTestBitmap.dll and OblTestSurface.dll.


I recreated the first one and it works. No idea what's the issue. I would expect that all these bitmap calls return null. Maybe an issue with the pdn dlls? I'm still referencing 3.5.11.

I attached the solution. The referenced dlls are in the Release folder. Maybe just try TestEffect.dll first if you like.



Link to post
Share on other sites

The issue is here:

protected override ConfigurationOfUI OnCustomizeUI()
            //the issue is PropertyBasedLook = true
            //return new ConfigurationOfUI { PropertyBasedLook = true };
            return new ConfigurationOfUI();


  • Upvote 1
Link to post
Share on other sites

@NSDYou are right (at least I'm getting this quite tiny rectangle).

I have a rough idea about the intention of this flag but I'm sure it's more than these 5 years that I tested if it works).

In the moment I would say just don't set it to true.

I'm not sure that I will support it in the future. Maybe it would be better to remove it completely from the code,

Just no time to run tests for all these cases. difficult enough to test if it works on Win7 with and without Aero.

Will add a warning on the first page. Thanks all for looking in this issue.





Link to post
Share on other sites
  • 3 weeks later...

Related to the topic  PropertyBased UI: All PropertyBased Controls, I like to show the differences between PropertyBased and OptionBased Controls. Just focused on the same set of controls.


Enabled  122326491_PdnUiBasicOptionBasedControls-Enabled.thumb.png.e75a3cb41fcee6ea17540cd359184d38.png     Disabled  1099388493_PdnUiBasicOptionBasedControls-Disabled.thumb.png.ca69a3ac631c38ed58baa317e81fc06e.png



The main differences between OptionBased and ProperyBased are (in Dark Theme)

  • the focus rectangle is white and not black
  • the background of disabled textboxes and numeric boxes stays dark


  • Like 1
Link to post
Share on other sites

I worked a bit on the HelpButton implementation. Beside of the possibilities to show an alert or a help window I decided to add the classic balloon help support.

This works in the way that you are clicking the help button and the cursor changes to an arrow with an question mark. Clicking an options shows the balloon help.



As always in OBL dll the help text is defined (and can be translated) in the dlc file.

You will also getting the help ballon by pressing F1 if one element in an OptionControl has the focus.

The title of the Balloon is the DisplayName

The implementation was easy. You just have to override the OnHelpRequest method and show the balloon there.

I tried HelpProvider class first but it is buggy and somehow clamped to the mainscreen.

Link to post
Share on other sites

I remember discussions why it is not a good idea to save and restore the position of the effect dialogs.

The main argument was that it may happen that the dialog is no longer visible after a reconfiguration of the screens.

This would raise support issues.


OBL dialogs are saving/restoring the position but there is a mechanism implemented which checks that the caption of the dialog is always visible on a screen.

The following snippet shows how it works


form.Location = CatchBoundsToScreens(rememberedBounds).Location;


        /// <summary>
        /// Catches the location of the rectangle to the screen containing the
        /// largest portion of the rectangle. If no screen contains the rectangle
        /// the main screen will be used.
        /// </summary>
        /// <param name="bounds">Typically the bounds of a Form.</param>
        /// <returns>The catched rectangle.</returns>
        private Rectangle CatchBoundsToScreens(Rectangle bounds)
            // Retrieves a Screen for the display that contains the largest portion of the rectangle.
            var screen = Screen.FromRectangle(bounds);
            // we catch first bottom/right and after top/left
            if (bounds.Right > screen.Bounds.Right) bounds.X = screen.Bounds.Right - bounds.Width;
            if (bounds.Bottom > screen.Bounds.Bottom) bounds.Y = screen.Bounds.Bottom - bounds.Height;
            if (bounds.Left < screen.Bounds.Left) bounds.X = screen.Bounds.Left;
            if (bounds.Top < screen.Bounds.Left) bounds.Y = screen.Bounds.Top;
            return bounds;


Link to post
Share on other sites
  • 5 weeks later...

Still working on refactoring of OBL to get a consistent interface for users an developers...


There is a new OptionControl flag 'ReverseControlOrder' (and the same for the default UI configuration) to change the order of the sub controls.

This is mostly useful if 'DisplayLabel' (old name 'Label') is used for an Optioncontrol because the NUD value is then next to the DisplayLabel (like for all the other OptionControls not showing NUDs).



The screenshot on the right uses 'ReverseControlOrder'.


What I really don't like are the blue thumbs on the sliders (which turns to black on hovering the thumb). It should be vice versa (especially in dark mode).

But I'm not sure that I can change this.


I also changed the default formatting if NUDs to use

(ThousandsSeparator ? "#,##0." : "0.") + new string('#', DecimalPlaces), CultureInfo.CurrentCulture

which allows the ThousandsSeparator and suppresses trailing zeros (not visible in the screenshot because I just changed it).

I'm not sure if I should add a flag for this formatting.








Link to post
Share on other sites

Thanks to the Native TrackBar control it wasn't too difficult to change the appearance of the sliders in the different states.



Hope you like it more than the old blue one provided from .net TrackBar. 'Hot' means the mouse hovers the slider thumb, 'Pressed' the user moves the thumb with the mouse. In 'normal' mode the thumb shows always the BackColor.

If the controls shows tick marks then the thumb outline will be .pointing to the ticks bar.

Also added the default value marker.



  • You're a Smart Cookie! 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...