Hi. Is it possible to turn off the borders surrounding textfield and combobox gadgets etc in MaxGUI, and if so how does one do it? I do not see a flag for it anywhere, but surely it is possible to do? The end result would be all the usual gadgets for text input/selection etc, but with the borders stripped off to remove that sunken-in look. Any ideas?
Turning off gadget borders
BlitzMax Forums/BlitzMax GUI Programming/Turning off gadget borders This is pretty easy on Windows, dunno about the other platforms though.
GadgetBorder.bmx
GadgetBorder.bmx
SuperStrict Import PUB.Win32 Import MaxGUI.Drivers 'Import BRL.MaxGUI Private ?Win32 Const RDW_ERASE:Int = 4 Const RDW_FRAME:Int = 1024 Const RDW_INTERNALPAINT:Int = 2 Const RDW_INVALIDATE:Int = 1 Const RDW_NOERASE:Int = 32 Const RDW_NOFRAME:Int = 2048 Const RDW_NOINTERNALPAINT:Int = 16 Const RDW_VALIDATE:Int = 8 Const RDW_ERASENOW:Int = 512 Const RDW_UPDATENOW:Int = 256 Const RDW_ALLCHILDREN:Int = 128 Const RDW_NOCHILDREN:Int = 64 Extern "Win32" Function RedrawWindow:Int( hwnd:Int, rect:Byte Ptr, region:Int, flags:Int) EndExtern ? Public Const BORDER_NONE:Int = 0 Const BORDER_3D:Int = 1 Const BORDER_THIN:Int = 2 Function SetGadgetBorder( gadget:TGadget, bordertype:Int) ?MacOS DebugLog "SetGadgetBorder() doesnt support MacOS" ?Linux DebugLog "SetGadgetBorder() doesnt support Linux" ? ?Win32 Local hwnd:Int = gadget.Query( QUERY_HWND) Local style:Int = GetWindowLongW( hwnd, GWL_STYLE) Local exstyle:Int = GetWindowLongW( hwnd, GWL_EXSTYLE) Select bordertype Case BORDER_NONE ' remove both border types If style & WS_BORDER Then SetWindowLongW( hwnd, GWL_STYLE, style & ~WS_BORDER) If exstyle & WS_EX_CLIENTEDGE Then SetWindowLongW( hwnd, GWL_EXSTYLE, exstyle & ~WS_EX_CLIENTEDGE) Case BORDER_THIN ' add thin border & remove 3d border If Not (style & WS_BORDER) Then SetWindowLongW( hwnd, GWL_STYLE, style | WS_BORDER) If exstyle & WS_EX_CLIENTEDGE Then SetWindowLongW( hwnd, GWL_EXSTYLE, exstyle & ~WS_EX_CLIENTEDGE) Case BORDER_3D ' remove thin border & add 3d border If style & WS_BORDER Then SetWindowLongW( hwnd, GWL_STYLE, style & ~WS_BORDER) If Not (exstyle & WS_EX_CLIENTEDGE) Then SetWindowLongW( hwnd, GWL_EXSTYLE, exstyle | WS_EX_CLIENTEDGE) EndSelect ' update window frame SetWindowPos( hwnd,0, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED) RedrawWindow( hwnd, Null,0, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME) ? EndFunction
Thanks grable! :) May I ask where you found such information, and how to use it?
May I ask where you found such information, and how to use it?
MSDN has all Win32 (and other Windows specific) API documentation.
http://msdn2.microsoft.com/en-us/library/aa383686.aspx is a good starting place.
Using the code i supplied, all you have to do is:
SetGadgetBorder( gadget_with_border, BORDER_NONE)