Jump to content

Recommended Posts

Posted

Does anyone know how to add a style to an existing Rebar control?

I'm referring to the styles that are added initially with _GUICtrlRebar_Create (eg. $CCS_TOP, $RBS_VARHEIGHT, etc.). I see functions for adding styles to rebar bands, but not the rebar control itself.

For example, I would like to add the $CCS_NODIVIDER style to an existing rebar control because it gets rid of the empty few pixels right above the rebar control and therefore improves the overall design goal for dark mode.

Posted
5 hours ago, WildByDesign said:

Do you think that you could somehow fill that bright white bar gripper (0xf0f0f0) with a more palatable color for dark mode?

Yes I think so.  You could do it I believe in post-paint.  But I will not invest in that path as I don't think a few pixels darker would make a difference.  Since a solution was found without subclassing, I would tend to suggest an alternative approach to darken the text and leave the gripper white.  Although it is your decision...

Posted
4 hours ago, WildByDesign said:

I would like to add the $CCS_NODIVIDER style to an existing rebar control because it gets rid of the empty few pixels right above the rebar control

Hello :)
I just tested the following code on Nine's script (his last rebar script from precedent page)
So yes you can add the $CCS_NODIVIDER style after the rebar control was created, for example with this code :

...
Local $hReBar = _GUICtrlRebar_Create($hGUI, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
; Control Viewer => 0x56002601 = CCS_TOP, RBS_VARHEIGHT, RBS_BANDBORDERS, RBS_AUTOSIZE, WS_CHILD, WS_VISIBLE, WS_CLIPSIBLINGS, WS_CLIPCHILDREN
...

GUISetState()

_WinAPI_SetWindowLong($hReBar, $GWL_STYLE, BitOR(_WinAPI_GetWindowLong($hReBar, $GWL_STYLE), $CCS_NODIVIDER))
; Control Viewer => 0x56002641 = CCS_TOP, CCS_NODIVIDER, RBS_VARHEIGHT, RBS_BANDBORDERS, RBS_AUTOSIZE, WS_CHILD, WS_VISIBLE, WS_CLIPSIBLINGS, WS_CLIPCHILDREN

; _WinAPI_SetWindowPos seems to do the job and makes disappear the 2 row of pixels above the rebar control.
_WinAPI_SetWindowPos($hReBar, 0, 0, 0, 0, 0, $SWP_NOMOVE) ; ok
; _WinAPI_SetWindowPos($hReBar, 0, 0, 0, 0, 0, $SWP_NOSIZE) ; ok
; _WinAPI_SetWindowPos($hReBar, 0, 0, 0, 0, 0, $SWP_NOZORDER ) ; ok
; _WinAPI_SetWindowPos($hReBar, 0, 0, 0, 0, 0, $SWP_FRAMECHANGED) ; ok

Now what happens without _WinAPI_SetWindowPos :
1) I couldn't do it with _WinAPI_RedrawWindow($hReBar), maybe I didn't use the correct flags.
2) Also without _WinAPI_SetWindowPos, the 2 pixels appear but as soon as you drag a band under the other, then the 2 rows of pixels disappear forever !

That's why it seems better to use _WinAPI_SetWindowPos which redraws the rebar control and makes the 2 pixels above disappear, sticking nearly the rebar control to the gui top border, without any manual interaction with the bands.

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
53 minutes ago, pixelsearch said:

Hello :)

Hello. It is always a special day when you swing by and save the day. I am incredibly thankful and surprised. :)

I know that I am quite often nitpicky about 1 pixel here, 2 pixels there, and so on. But it all comes together in the end. As you can see with this antique, un-themed Rebar control, every pixel counts toward making it appear like a modern control. For example, adjusting the _GUICtrlRebar_SetColorScheme to blend in the highlight pixels with the main color along with the pixels surrounding the gripper bars.

There is always a method to my madness. Well, usually... :thumbsup:

Needless to say, your _WinAPI_SetWindowLong / _WinAPI_SetWindowPos trick works perfectly and finalizes the missing 2 pixels of the design goal. The Rebar code is ready now.

1 hour ago, pixelsearch said:

Now what happens without _WinAPI_SetWindowPos :
1) I couldn't do it with _WinAPI_RedrawWindow($hReBar), maybe I didn't use the correct flags.
2) Also without _WinAPI_SetWindowPos, the 2 pixels appear but as soon as you drag a band under the other, then the 2 rows of pixels disappear forever !

I am so glad that you were able to figure it out. I've had similar situations where I had to use _WinAPI_RedrawWindow and other situations where I've had to use _WinAPI_SetWindowPos, so I quite often don't feel 100% confident about which one will succeed. Although ultimately it quite often comes down to choosing the right parameters/values for either one, depending on the specific situation.

Thank you, thank you, thank you. 🍷

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...