CheckBox inside scrollbars of StringGadget?

Just starting out? Need help? Post your questions and find answers here.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

CheckBox inside scrollbars of StringGadget?

Post 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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post by localmotion34 »

try the drawframecontrol_() command. subclass the editor and every time there is a #wm_paint message, draw the frame control.

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

localmotion34 wrote:... subclass ...
I've seen this (subclassing) suggested a few times in different contexts.

How is something subclassed in PureBasic?

Thanks!
@}--`--,-- A rose by any other name ..
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I may look like a mule, but I'm not a complete ass.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Thank you, that is very interesting! :)
@}--`--,-- A rose by any other name ..
Post Reply