Textbox Idea

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Textbox Idea

Post by Rook Zimbabwe »

:idea:

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...
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Post 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 .....
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post 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
--Kale

Image
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post 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. :mrgreen:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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".
Post Reply