WildByDesign Posted May 23 Author Posted May 23 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.
Nine Posted May 23 Posted May 23 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... WildByDesign 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
pixelsearch Posted May 24 Posted May 24 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. WildByDesign 1 "I think you are searching a bug where there is no bug... don't listen to bad advice."
WildByDesign Posted May 24 Author Posted May 24 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... 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. 🍷 pixelsearch 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now