Canvas Gadget - Option to be a Container

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Canvas Gadget - Option to be a Container

Post by IdeasVacuum »

There are discussions and work-arounds on the forum about putting gadgets on top of a Canvas Gadget. It would be tremendous if the Canvas Gadget could optionally be flagged as being a Container.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Canvas Gadget - Option to be a Container

Post by Josh »

+1
sorry for my bad english
Mohawk70
Enthusiast
Enthusiast
Posts: 404
Joined: Thu May 11, 2006 1:04 am
Location: Florida, USA

Re: Canvas Gadget - Option to be a Container

Post by Mohawk70 »

+1 - I have plenty of uses for this one !
HP Z800 Workstation
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Canvas Gadget - Option to be a Container

Post by Josh »

i use this code as workaround. works fine.
sorry for my bad english
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Canvas Gadget - Option to be a Container

Post by skywalk »

Josh wrote:i use this code as workaround. works fine.
The code is not complete. If you change the canvas cursor to let the user know visually which has focus, it fails after the string gadget gets focus.
Add -> SetGadgetAttribute(0,#PB_Canvas_Cursor, #PB_Cursor_Cross)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Canvas Gadget - Option to be a Container

Post by Josh »

skywalk wrote:The code is not complete. If you change the canvas cursor to let the user know visually which has focus, it fails after the string gadget gets focus.
Add -> SetGadgetAttribute(0,#PB_Canvas_Cursor, #PB_Cursor_Cross)
I can't follow. If the cursor leave the stringgadget, the cursor change to mode, was before at the canvasgadget. In the example there is no use of the cross cursor.
sorry for my bad english
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Canvas Gadget - Option to be a Container

Post by skywalk »

I'm saying the cursor always stays at IBeam which does not tell me if the stringgadget or canvasgadget has the focus?
And, if I change the canvasgadget cursor to Cross initially, it still does not respect that cursor in your callback.

Code: Select all

If OpenWindow(0, 0, 0, 220, 220, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 10, 10, 200, 200, #PB_Canvas_Keyboard|#PB_Canvas_DrawFocus)
  SetGadgetAttribute (0, #PB_Canvas_Cursor, #PB_Cursor_Cross)  ;<-- Add this and no respect...
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Canvas Gadget - Option to be a Container

Post by Josh »

skywalk wrote:I'm saying the cursor always stays at IBeam which does not tell me if the stringgadget or canvasgadget has the focus?
And, if I change the canvasgadget cursor to Cross initially, it still does not respect that cursor in your callback.
Ok, the problem was, that there is no automatic WM_MOUSELEAVE event, if XP skin support is disabled. I added the function TrackMouseEvent, so that the WM_MOUSELEAVE event is send in each case. code in german forum corrected.
sorry for my bad english
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Canvas Gadget - Option to be a Container

Post by skywalk »

Very nice 8)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply