Page 1 of 1
Help with ownerdraw custom edit gadget
Posted: Fri Nov 05, 2021 1:40 pm
by jacdelad
I'm not firm with custom drawing windows controls. I just know that it opens the world for very powerful customizations. However, is it possible (with ownerdrawing) to extend an edit gadget with things like the clickable "X" on the right that erases the content or the spyglass in the left? I know I can do it with a canvas gadget and such, but an extended edit gadget would be much more comfortable.
Re: Help with ownerdraw custom edit gadget
Posted: Fri Nov 05, 2021 5:20 pm
by chi
How about using a CanvasGadget as a container?
Code: Select all
OpenWindow(0, 0, 0, 320, 200, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CanvasGadget(0, 85, 85, 150, 21, #PB_Canvas_Container)
EditorGadget(1, 25, 1, 100, 19)
CloseGadgetList()
StartDrawing(CanvasOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(7, 2, "...", #Black)
DrawText(134, 2, "x", #Black)
StopDrawing()
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
Re: Help with ownerdraw custom edit gadget
Posted: Fri Nov 05, 2021 7:02 pm
by RASHAD
Hi
You can use ButtonGadget() or ButtonImageGadget() too
Code: Select all
OpenWindow(0, 0, 0, 320, 200, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(1,290,10,20,20,"X",#WS_CLIPSIBLINGS |#WS_BORDER|#SS_CENTER|#SS_CENTERIMAGE|#SS_NOTIFY)
SetGadgetColor(1,#PB_Gadget_FrontColor,$0000FF)
EditorGadget(0, 5, 5, 310, 190,#WS_CLIPSIBLINGS)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Case 1
ClearGadgetItems(0)
EndSelect
EndSelect
Until Quit = 1
Re: Help with ownerdraw custom edit gadget
Posted: Fri Nov 05, 2021 10:29 pm
by jacdelad
...and that's both things I didn't want to...