Page 1 of 1
Textbox Idea
Posted: Fri Jan 05, 2007 6:07 pm
by Rook Zimbabwe
I was playing around with eh PB default form designer and I noticed the TEXTBOX Gadget had a background color same as the window...
I was wondering if it were possible to have CLEAR as a selection on the TEXTBOX control?
I did search the forums for at least 15 - 20 mins and saw many related topics stating TRANSPARENT this and that but noting concrete...
Posted: Fri Jan 05, 2007 6:33 pm
by Trond
I don't understand what you want. To set the background colour of a TextGadget use the SetGadgetColor() function. The same applies to a StringGadget.
Posted: Fri Jan 05, 2007 9:32 pm
by le_magn
Trond wrote:I don't understand what you want. To set the background colour of a TextGadget use the SetGadgetColor() function. The same applies to a StringGadget.
I think, for example the problem is: if i apply textgadget over a image, I want to see only the text without no color of background (transparent ), it is possible? if like? Thanks thousands .....
Posted: Fri Jan 05, 2007 10:17 pm
by Trond
le_magn wrote:Trond wrote:I don't understand what you want. To set the background colour of a TextGadget use the SetGadgetColor() function. The same applies to a StringGadget.
I think, for example the problem is: if i apply textgadget over a image, I want to see only the text without no color of background (transparent ), it is possible? if like? Thanks thousands .....
Firstly, gadgets aren't "over" and "under". All of them are on the same layer.
But if you want a transparent background on the text gadget:
Code: Select all
Procedure WinProc(hWnd, Msg, wParam, lParam)
Protected Result = #PB_ProcessPureBasicEvents
Select Msg
Case #WM_CTLCOLORSTATIC
SetBkMode_(wParam, #TRANSPARENT)
Result = GetStockObject_(#NULL_BRUSH)
EndSelect
ProcedureReturn Result
EndProcedure
OpenWindow(0,0,0,230,90,".",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SetWindowCallback(@WinProc())
CreateGadgetList(WindowID(0))
TextGadget(1, 11, 11, 208, 38, "Some text goes here with path\pathname\subpath")
HideWindow(0, 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Posted: Fri Jan 05, 2007 11:53 pm
by Kale
Trond wrote:gadgets aren't "over" and "under". All of them are on the same layer.
You can have gadgets appear over other gadgets. The z order is determined by the creation order in Purebasic.
For example in C#:
http://tozon.info/blogs/andrej/archive/ ... order.aspx
Posted: Sat Jan 06, 2007 3:36 am
by Rook Zimbabwe
You can have gadgets appear over other gadgets. The z order is determined by the creation order in Purebasic.
It appears to be reverse order I had to set the TEXTBOX first THEN set the image...
Code: Select all
Procedure WinProc(hWnd, Msg, wParam, lParam)
Protected Result = #PB_ProcessPureBasicEvents
Select Msg
Case #WM_CTLCOLORSTATIC
SetBkMode_(wParam, #TRANSPARENT)
Result = GetStockObject_(#NULL_BRUSH)
EndSelect
ProcedureReturn Result
EndProcedure
Enumeration
#Image_0
EndEnumeration
;- Image Plugins
UseJPEGImageDecoder()
;- Image Globals
Global Image0
;- Catch Images
Image0 = CatchImage(0, ?Image0)
;- Images
DataSection
Image0:
IncludeBinary "C:\Documents and Settings\Ralph\My Pictures\imperialsymbol.jpg"
; a small icon sized image ( 80X80 )just to test this idea!
EndDataSection
OpenWindow(0,0,0,230,190,".",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SetWindowCallback(@WinProc())
CreateGadgetList(WindowID(0))
TextGadget(1, 11, 11, 208, 38, "TROND Rules!!! This works!!! Hi Mom!!!")
ImageGadget(#Image_0, 10, 10, 100, 105, Image0)
HideWindow(0, 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
TROND that does do it! I just wish I didn't have to use my own function to set it up.

Posted: Sat Jan 06, 2007 1:36 pm
by Trond
Kale wrote:Trond wrote:gadgets aren't "over" and "under". All of them are on the same layer.
You can have gadgets appear over other gadgets. The z order is determined by the creation order in Purebasic.
Well it doesn't work. The point is that if one of the gadgets receives a repaint event it will repaint. The one that is repainted last will look on top. By carefully moving out of the screen so that one gadget is repainted, that gadget will get "on top".