ProGUI V1.38 UI Library (Small Bug Fix)

Developed or developing a new product in PureBasic? Tell the world about it.
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

Re: ProGUI V1.31 User Interface Library (Bug Fix Release)

Post by ruslanx »

Hi PrincieD, how can I change background color of a string gadget ...SetGadgetColor not working ... ??~!

from 'PreferencesExample.pb' :

Code: Select all

  ;/ connection pannel
  window = AddPanelExImagePage(0, image(5)\normal, 0, 0, 0, 0, #PNLX_CENTRE|#PNLX_VCENTRE)
  TextControlEx(window, #TextControl_1, 2, 2, 434, 0, "Connection", #TCX_BK_GRADIENT|#TCX_TRANSPARENT|#TCX_VCENTRE)
  
  window = Frame3DGadget(#Frame3D_7, 13, 44, 410, 90, "IRC Details")
  SetWindowLongPtr_(window, #GWL_EXSTYLE, GetWindowLongPtr_(window, #GWL_EXSTYLE)|#WS_EX_TRANSPARENT)
  TextGadget(#Text_10, 30, 68, 60, 20, "Nick Name")
  hStringGadget = StringGadget(#String_9, 90, 68, 120, 20, "")

  SetGadgetColor(#String_9,#PB_Gadget_BackColor ,RGB(230, 54, 146))        ;<<<<<<<<<<<<

  SendMessage_(hStringGadget, #EM_SETLIMITTEXT, 9, 0)
.....
Poshu
Enthusiast
Enthusiast
Posts: 459
Joined: Tue Jan 25, 2005 7:01 pm
Location: Canada

Re: ProGUI V1.31 User Interface Library (Bug Fix Release)

Post by Poshu »

Well, Progui is not compatible with pb command set, you need to check the documentation and SetTextControlExColour(ID.i, TextColour.l, BackColour.l)
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.31 User Interface Library (Bug Fix Release)

Post by PrincieD »

ruslanx wrote:Hi PrincieD, how can I change background color of a string gadget ...SetGadgetColor not working ... ??~!

from 'PreferencesExample.pb' :

Code: Select all

  ;/ connection pannel
  window = AddPanelExImagePage(0, image(5)\normal, 0, 0, 0, 0, #PNLX_CENTRE|#PNLX_VCENTRE)
  TextControlEx(window, #TextControl_1, 2, 2, 434, 0, "Connection", #TCX_BK_GRADIENT|#TCX_TRANSPARENT|#TCX_VCENTRE)
  
  window = Frame3DGadget(#Frame3D_7, 13, 44, 410, 90, "IRC Details")
  SetWindowLongPtr_(window, #GWL_EXSTYLE, GetWindowLongPtr_(window, #GWL_EXSTYLE)|#WS_EX_TRANSPARENT)
  TextGadget(#Text_10, 30, 68, 60, 20, "Nick Name")
  hStringGadget = StringGadget(#String_9, 90, 68, 120, 20, "")

  SetGadgetColor(#String_9,#PB_Gadget_BackColor ,RGB(230, 54, 146))        ;<<<<<<<<<<<<

  SendMessage_(hStringGadget, #EM_SETLIMITTEXT, 9, 0)
.....
Hi ruslanx,

This is a bit of an oversight/bug in PureBasic. The StringGadget isn't actually coloured by the Windows API it's coloured by owner-draw code that PureBasic handles, unfortunately PureBasic doesn't keep track of the StringGadget if it's inside a none PB window using UseGadgetList and hence the owner-draw code is not executed. The owner-draw code that colours the string gadget is apparently in the main window callback instead of being in the actual string gadget's callback :?

I can't think of a work around at the moment but there might be one. I'll be adding a skinned edit gadget very soon to ProGUI anyway so this won't be an issue in the future.

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: ProGUI V1.31 User Interface Library (Bug Fix Release)

Post by blueznl »

> unfortunately PureBasic doesn't keep track of the StringGadget if it's inside a none PB window using UseGadgetList

'inside a none' may cause some confusion...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.31 User Interface Library (Bug Fix Release)

Post by PrincieD »

blueznl wrote:> unfortunately PureBasic doesn't keep track of the StringGadget if it's inside a none PB window using UseGadgetList

'inside a none' may cause some confusion...
Sorry I meant a window created using the Windows API not PB's OpenWindow()

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.31 User Interface Library (Bug Fix Release)

Post by PrincieD »

Hey guys, just realised that ProGUI is using about 400 meg (64bit version) of virtual memory in ProcessExplorer :shock: :shock: I've isolated it down to the skin subsystem using nested maps in the structures so beware of this if you have a map of a structure with another map of a structure inside that one and so on. I'll be re-factoring the internals to use just linked lists for the skin subsystem over the next few days but don't worry the external API will remain unchanged. What a bummer lol *sigh

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by PrincieD »

Fixed! :D

See top of thread!

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by electrochrisso »

Great stuff.
Keep up the good work. :)
PureBasic! Purely the best 8)
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by PrincieD »

electrochrisso wrote:Great stuff.
Keep up the good work. :)
Thanks mate! :)
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Starwolf20
User
User
Posts: 25
Joined: Fri Sep 04, 2009 7:08 pm
Location: Corsica

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by Starwolf20 »

Hi PrincieD
I'am trying the Imagebutton but i can't manage to make it work like i want to :
It seems that ExbuttonImageEx() and ToolBarImageButtonEx() acts differently when you pass the mouse on them.
With ImageToolBarEx(),the 'normal' image and the 'hot' image mixes.
Bye

Code: Select all

; Remember to enable XP Skin Support!
; Demonstrates how ProGUI components can easily be used
; to create novel, attractive and sophisticated user interfaces.

CompilerIf Defined(StartProGUI, #PB_Function) = #False
  IncludeFile "ProGUI_PB.pb"
CompilerEndIf
StartProGUI("", 0, 0, 0, 0, 0, 0, 0)

Global w_xpos
Global w_ypos
Global w_width
Global w_height
w_width = 800
w_height = 600

;- Window Constants
Enumeration
  #Window_0
EndEnumeration

Enumeration
  #TOOLBAR_0
EndEnumeration

Enumeration
  #TBUTTON_12
  #TBUTTON_16
  #TBUTTON_16b
EndEnumeration

; set up structure for easy access to images
Structure images
  normal.l
  hot.l
  disabled.l
EndStructure
Global Dim image.images(60)

;- Load in some images
ImgPath("Icons\DCCManager") ; set the default path for LoadImg

; preferences button
image(12)\normal = LoadImg("wrench.ico", 0, 0, 0)
image(12)\hot = LoadImg("wrench_h.ico", 0, 0, 0)
image(12)\disabled = LoadImg("wrench_p.ico", 0, 0, 0)

; about button
image(29)\normal = LoadImg("DCC2_32x32.ico", 0, 0, 0)
image(29)\hot = LoadImg("DCC2_32x32_h.ico", 0, 0, 0)
image(29)\disabled = LoadImg("DCC2_32x32_p.ico", 0, 0, 0)


Procedure Open_Window_0()
   
  OpenWindow(#Window_0, 0, 0, w_width, w_height, "DCC Manager V1.8 User Interface Example", #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget); | #PB_Window_Invisible)
  WindowBounds(#Window_0, 400, 200, #PB_Ignore, #PB_Ignore)
  SetWindowColor(#Window_0, $996633)

  If IsWindow(#Window_0)
    toolbar = CreateToolBarEx(#TOOLBAR_0, WindowID(#Window_0), 53, 39, #UISTYLE_IMAGE)
    
    ToolBarImageButtonEx(#TBUTTON_12, "", image(12)\normal, image(29)\hot, image(29)\disabled, #BTNS_AUTOSIZE)
    ToolBarImageButtonEx(#TBUTTON_16, "", image(29)\normal, image(29)\hot, image(29)\disabled, #BTNS_AUTOSIZE)
  EndIf
  ImageButtonEx(WindowID(#Window_0),    #TBUTTON_16b, 100, 100, 0, 0,  image(12)\normal, image(29)\hot, image(29)\hot, image(12)\disabled)
EndProcedure


Open_Window_0()
;HideWindow(#Window_0, #False)

Repeat
  Event = WaitWindowEvent()

   If Event = #PB_Event_Gadget
    gadget = EventGadget()
    Debug "gadget=" + Str(gadget)
  EndIf
  
Until Event = #WM_CLOSE
CloseWindow(#Window_0)
End
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by PrincieD »

Starwolf20 wrote:Hi PrincieD
I'am trying the Imagebutton but i can't manage to make it work like i want to :
It seems that ExbuttonImageEx() and ToolBarImageButtonEx() acts differently when you pass the mouse on them.
With ImageToolBarEx(),the 'normal' image and the 'hot' image mixes.
Hi Starwolf20,

The ImageButtonEx doesn't support "cross fade" animation between the states yet, this will come later once I've refined the animation sub-system a bit.
If you want this effect then you can just use a "one button" ToolbarEx with the #UISTYLE_IMAGE flag set like you have in your posted code.

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Starwolf20
User
User
Posts: 25
Joined: Fri Sep 04, 2009 7:08 pm
Location: Corsica

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by Starwolf20 »

PrincieD wrote:If you want this effect then you can just use a "one button" ToolbarEx
Yes, thanks
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by Kuron »

PrincieD: Two questions for you:

1. Have you had a chance to look at the slow start up issue?
2. If so, have you had a chance to update the compiled examples?
Best wishes to the PB community. Thank you for the memories. ♥️
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by PrincieD »

Kuron wrote:PrincieD: Two questions for you:

1. Have you had a chance to look at the slow start up issue?
2. If so, have you had a chance to update the compiled examples?
Hey Kuron,

Yep it's been fixed since V1.31, the DLL version should load up almost instantaneously now :)

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
PrincieD
Addict
Addict
Posts: 858
Joined: Wed Aug 10, 2005 2:08 pm
Location: Yorkshire, England
Contact:

Re: ProGUI V1.32 User Interface Library (Huge Memory Usage F

Post by PrincieD »

Hey guys!

Here's a new ButtonEx example demonstrating basic skin modification and the fancy effects you can achieve by dropping them into a PanelEx page :)

Just save the following code into your ProGUI Examples folder:

Code: Select all

; Remember to enable XP Skin Support!
; Demonstrates how to use the ButtonEx controls

CompilerIf Defined(StartProGUI, #PB_Function) = #False
  IncludeFile "ProGUI_PB.pb"
CompilerEndIf
StartProGUI("", 0, 0, 0, 0, 0, 0, 0)


;- Window Constants
Enumeration
  #Window_0
EndEnumeration

;- Menu/Button Command Constants
Enumeration
  #Command_Button1
  #Command_Button2
  #Command_Button3
EndEnumeration

; set up structure for easy access to icon images
Structure images
  normal.i
  hot.i
  pressed.i
  disabled.i
EndStructure
Global Dim image.images(3)

; load in some example icons
image(0)\normal = LoadImg("icons\shell32_235.ico", 16, 16, 0)
image(0)\hot = ImgBlend(image(0)\normal, 255, 30, 0, 0, 0, 0)
image(0)\pressed = ImgBlend(image(0)\normal, 255, 0, -30, 0, 0, 0)
image(1)\normal = ImgBlend(LoadImg("icons\shell32_4.ico", 96, 96, 0), 100, 0, 0, 0, 0, #ImgBlend_DestroyOriginal)
image(2)\normal = LoadImg("icons\dccmanager\downloadpanel_border.png", 0, 0, 0)

;- process ProGUI Windows event messages here
; events can also be simply captured using WaitWindowEvent() too in the main event loop, but for ease of porting the examples to other languages the callback method is used.
; #PB_Event_Menu and EventMenu() can be used to get the selected menu item when using the WaitWindowEvent() method.
Procedure ProGUI_EventCallback(hwnd, message, wParam, lParam)
  
  Select message
      
    ; handle selection of menu items and buttons
    Case #WM_COMMAND
      
      If HWord(wParam) = 0 ; is an ID
          
        MenuID = LWord(wParam)
      
        Debug MenuID
        
      EndIf
        
    ; resize panelex and textcontrolex when main window resized
    Case #WM_SIZE
      
      MoveWindow_(PanelExID(0, -1), 5, 5, WindowWidth(#Window_0)-10, WindowHeight(#Window_0)-10, #True)
      
  EndSelect
  
  ProcedureReturn #PB_ProcessPureBasicEvents
  
EndProcedure

; creates a window
Procedure Open_Window_0()
  
  OpenWindow(#Window_0, 50, 50, 700, 500, "Button Example: Resize the main window!", #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_Invisible)
  
  ; create PanelEx as main window content
  CreatePanelEx(0, WindowID(#Window_0), 215, 5, 480, 490, 0)
  page = AddPanelExImagePage(2, image(1)\normal, 0, 0, 0, 0, #PNLX_CENTRE|#PNLX_VCENTRE)
  SetPanelExPageBorder(0, 0, image(2)\normal, -1, 0, 0)
  SetPanelExPageScrolling(0, 0, #PNLX_AUTOSCROLL, #True)
  
  ButtonEx(page, #Command_Button1, 100, 100, 200, 100, "A Great Big Button!", 0, 0, 0, 0, 0)
  ButtonEx(page, #Command_Button2, 100, 200, 160, 32, "Button and Icon", image(0)\normal, image(0)\hot, image(0)\pressed, 0, 0)
  
  ; copy system default skin of ButtonEx
  skin = GetButtonExSkin(#Command_Button1)
  newSkin = CopySkin(skin)
  ; make position of icon for normal state left aligned
  SetSkinProperty(newSkin, "buttonex", "normal", "image position", "x: 0; y: centre")
  ; add a background image for hot state
  SetSkinProperty(newSkin, "buttonex", "hot", "background image", "icons\newlogo2_256x256.png")
  ; make text red for hot state
  SetSkinProperty(newSkin, "buttonex", "hot", "text", "colour: red")
  ButtonEx(page, #Command_Button3, 400, 200, 200, 64, "Button and Modified Skin", image(0)\normal, image(0)\hot, image(0)\pressed, 0, newSkin)
  
  
  ; attach our events callback for processing Windows ProGUI messages
  SetWindowCallback(@ProGUI_EventCallback())
  
EndProcedure


Open_Window_0() ; create window
HideWindow(0, 0)  ; show our newly created window

; enter main event loop
Repeat
  
  Event = WaitWindowEvent()
  
Until Event = #WM_CLOSE

End
Cheers!

Chris.
ProGUI - Professional Graphical User Interface Library - http://www.progui.co.uk
Locked