Page 1 of 1

CheckBox inside scrollbars of StringGadget?

Posted: Sat Nov 26, 2005 3:47 am
by PB
Hi, I'm trying to get a functioning CheckBox on top of a StringGadget, with it
placed in dead area in the corner where the horizontal/vertical scrollbars are:

Image

If I try to click the CheckBox, nothing happens. I've tried setting it to always
be on top (SetWindowPos API) and it doesn't help, and neither does setting
the StringGadget to not-on-top. If I press TAB to the CheckBox to give it the
focus, and then hit Space, I can set/unset it, but obviously I'd like it to also
work with mouse clicks. Any ideas?

Posted: Sat Nov 26, 2005 6:42 am
by Sparkie
Does this work for you PB :?:

Code: Select all

If OpenWindow(0, 0, 0, 220, 200, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "Test") And CreateGadgetList(WindowID(0))
  StringGadget(1, 10, 50, 200, 60, "Testing 1...................2...................3" + #CRLF$ + "second line..."+ #CRLF$ + "third line...", #PB_String_MultiLine | #ES_AUTOVSCROLL | #WS_VSCROLL | #WS_HSCROLL)
  CheckBoxGadget(0, 193, 95, 20, 10, "")
  SetWindowLong_(GadgetID(1), #GWL_STYLE, GetWindowLong_(GadgetID(1), #GWL_STYLE) | #WS_CLIPSIBLINGS) 
  SetWindowPos_(GadgetID(1), GadgetID(0), -1, -1, -1, -1, #SWP_NOSIZE | #SWP_NOMOVE)
  Repeat
    event = WaitWindowEvent()
  Until event = #PB_Event_CloseWindow
EndIf

Posted: Sat Nov 26, 2005 6:53 am
by PB
Thanks again Sparkie! :)

I did try it with the #WS_CLIPSIBLINGS flag (after I discovered your post
that I mentioned for resizing StringGadgets), but I didn't try this flag with
SetWindowPos at the same time, which is why I couldn't get it to work.

Posted: Sat Nov 26, 2005 6:59 am
by Sparkie
Your welcome again PB :)

It may also work without the SetWindowPos() if you create the CheckBoxGadget before the StringGadget.

Code: Select all

If OpenWindow(0, 0, 0, 220, 200, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "Test") And CreateGadgetList(WindowID(0)) 
  CheckBoxGadget(0, 193, 95, 20, 10, "") 
  StringGadget(1, 10, 50, 200, 60, "Testing 1...................2...................3" + #CRLF$ + "second line..."+ #CRLF$ + "third line...", #PB_String_MultiLine | #ES_AUTOVSCROLL | #WS_VSCROLL | #WS_HSCROLL) 
  SetWindowLong_(GadgetID(1), #GWL_STYLE, GetWindowLong_(GadgetID(1), #GWL_STYLE) | #WS_CLIPSIBLINGS) 
  Repeat 
    event = WaitWindowEvent() 
  Until event = #PB_Event_CloseWindow 
EndIf

Posted: Sat Nov 26, 2005 7:04 am
by PB
> It may also work without the SetWindowPos() if you create the CheckBoxGadget before the StringGadget

Can't; need to keep the tab order. :)

Posted: Sat Nov 26, 2005 4:16 pm
by localmotion34
try the drawframecontrol_() command. subclass the editor and every time there is a #wm_paint message, draw the frame control.

Posted: Sat Nov 26, 2005 4:40 pm
by Dare2
localmotion34 wrote:... subclass ...
I've seen this (subclassing) suggested a few times in different contexts.

How is something subclassed in PureBasic?

Thanks!

Posted: Sat Nov 26, 2005 4:53 pm
by srod

Posted: Sun Nov 27, 2005 12:52 am
by Dare2
Thank you, that is very interesting! :)