Page 1 of 1
Form Designer Bug With GadgetText
Posted: Wed Jul 20, 2016 4:09 pm
by LESTROSO
Dear Fred,
i 'm working on my program and i used Form designer to start it.
When i put an image like a wallpaper and i have added some gadget text...., the gadget text are not shown of course when i run and compile my program... I have tryed either png either jpg, but nothing works...
Best Regards,
Lestroso

Re: Form Designer Bug With GadgetText
Posted: Wed Jul 20, 2016 4:28 pm
by Keya
are you just using an image gadget? normally you would use a String or Editor gadget for text
If you are using an image gadget make sure you're not drawing the image over your text
Re: Form Designer Bug With GadgetText
Posted: Wed Jul 20, 2016 7:41 pm
by mhs
Keya wrote:If you are using an image gadget make sure you're not drawing the image over your text
With other words, there is no z-order, if you put text gadgets over an image gadget, this will not work.
Re: Form Designer Bug With GadgetText
Posted: Thu Jul 21, 2016 2:30 am
by netmaestro
PureBasic doesn't support overlapping gadgets. This is not a bug.
Re: Form Designer Bug With GadgetText
Posted: Thu Jul 21, 2016 5:21 am
by TI-994A
LESTROSO wrote:...an image like a wallpaper and i have added some gadget text...., the gadget text are not shown...
You could use a disabled
ImageGadget() as a wallpaper, or background image:
Code: Select all
; ================================================
; automatically loads a sample image from DropBox
; requires later versions of PureBasic for the
; ReceiveHTTPFile() function to work with DropBox
; ================================================
Enumeration
#MainWindow
#Background
#bgImage
#Button
#TitleFont
#Candidate
#CandidateFont
EndEnumeration
UseJPEGImageDecoder()
InitNetwork()
If FileSize(GetTemporaryDirectory() + "background.jpg") = -1
ReceiveHTTPFile("https://www.dropbox.com/s/7ay877rq3eq8kwi/stairway.jpg?dl=1",
GetTemporaryDirectory() + "background.jpg")
EndIf
LoadImage(#bgImage, GetTemporaryDirectory() + "background.jpg")
LoadFont(#TitleFont, "Times New Roman", 24, #PB_Font_Italic)
LoadFont(#CandidateFont, "Times New Roman", 12, #PB_Font_Italic)
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible
OpenWindow(#MainWindow, #PB_Any, #PB_Any, 1000, 550, "Image Background", wFlags)
StartDrawing(ImageOutput(#bgImage))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(#TitleFont))
DrawText(60, 30, "Stairway to Heaven...", RGB(0, 0, 255))
StopDrawing()
ImageGadget(#Background, 0, 0, 1000, 550, ImageID(#bgImage))
StringGadget(#Candidate, 100, 230, 190, 30, "enter your name here...")
ButtonGadget(#Button, 100, 265, 190, 30, "E N T E R !")
SetGadgetFont(#Candidate, FontID(#CandidateFont))
DisableGadget(#Background, #True)
DisableGadget(#Button, #True)
HideWindow(#MainWindow, #False)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
appQuit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case #Button
HideGadget(#Candidate, #True)
HideGadget(#Button, #True)
StartDrawing(ImageOutput(#bgImage))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(#TitleFont))
DrawText(770, 250, "Goodbye...", RGB(255, 200, 255))
StopDrawing()
SetGadgetState(#Background, ImageID(#bgImage))
Case #Candidate
Select EventType()
Case #PB_EventType_Focus
SetGadgetText(#Candidate, "")
Case #PB_EventType_Change
If Trim(GetGadgetText(#Candidate))
DisableGadget(#Button, #False)
Else
DisableGadget(#Button, #True)
EndIf
EndSelect
EndSelect
EndSelect
Until appQuit = 1
EDITS wrote:18th February 2019: updated download links
Re: Form Designer Bug With GadgetText
Posted: Thu Jul 21, 2016 6:12 am
by mestnyi
PureBasic doesn't support overlapping gadgets.
I do not want to support.
the gadget text are not shown
Add this code and calls to this procedure after creating all the gadgets.
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Procedure GadgetsClipCallBack( GadgetID, lParam )
If GadgetID
If GetWindowLongPtr_( GadgetID, #GWL_STYLE ) & #WS_CLIPSIBLINGS = #False
Protected Gadget = GetProp_( GadgetID, "PB_ID" )
If IsGadget( Gadget )
Select GadgetType( Gadget )
Case #PB_GadgetType_ComboBox
Protected Height = GadgetHeight( Gadget )
EndSelect
EndIf
SetWindowLongPtr_( GadgetID, #GWL_STYLE, GetWindowLongPtr_( GadgetID, #GWL_STYLE ) | #WS_CLIPSIBLINGS )
If Height
ResizeGadget( Gadget, #PB_Ignore, #PB_Ignore, #PB_Ignore, Height )
EndIf
SetWindowPos_( GadgetID, #GW_HWNDFIRST, 0,0,0,0, #SWP_NOMOVE|#SWP_NOSIZE )
EndIf
EndIf
ProcedureReturn GadgetID
EndProcedure
CompilerEndIf
Procedure ClipGadgets( WindowID )
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
EnumChildWindows_( WindowID, @GadgetsClipCallBack(), 0 )
CompilerEndIf
EndProcedure
Re: Form Designer Bug With GadgetText
Posted: Thu Jul 21, 2016 10:27 pm
by LESTROSO
I'm so sorry....
i have understood that purebasic have this limitation....
Thanks for sharing the codes to work around this problem....
Thanks again,Lestroso
