ProGUI problem

Just starting out? Need help? Post your questions and find answers here.
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

ProGUI problem

Post by wombats »

Hi,

Is anyone using ProGUI? I am having a problem with it and my emails to the author are going unanswered. I hope he is okay.

Whenever I use any of the ProGUI gadgets (SplitterEx, ButtonEx, etc.), my program doesn't close propery. The window closes, but the program is still running. If run from PureBasic, the "Kill Program" button is still enabled and PureBasic thinks the program is running. It also remains in Task Manager.

Has anyone encountered this and knows a fix to it?

Thanks.
RBeausoleil
User
User
Posts: 18
Joined: Tue Aug 20, 2019 6:47 pm

Re: ProGUI problem

Post by RBeausoleil »

Hi wombats,

I have ProGUi and I would like to help you.
Only without a code as an example, no one can really help you. So send us an example of the code that you have a problem with and, all those who like me have ProGUI will be able to help you.


PS. PrincieD, stopped the development of ProGUI in 2014 ... who knows if someday he will come back with a new product or, if someone will develop another similar product in the near future.


Roger Beausoleil Quebec - Canada
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: ProGUI problem

Post by wombats »

It happens with all of the ProGUI gadget examples (for example, ButtonExample.pb).

I know it hasn’t been updated in years, but he has responded by email in recent years.
RBeausoleil
User
User
Posts: 18
Joined: Tue Aug 20, 2019 6:47 pm

Re: ProGUI problem

Post by RBeausoleil »

Hi,

The problem is very simple.

Simply change the last line words "#WM_CLOSE" to "#PB_Event_CloseWindow".

Problem Solved!


Roger
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: ProGUI problem

Post by wombats »

Thank you for your reply. Unfortunately, that's not the problem. As I said in the first post, the program keeps running after the window is closed. It only happens when a ProGUI gadget is used...never with MenuEx, ToolBarEx and Rebars. This video shows the issue.
RBeausoleil
User
User
Posts: 18
Joined: Tue Aug 20, 2019 6:47 pm

Re: ProGUI problem

Post by RBeausoleil »

Try this code:

Code: Select all

; Remember to enable XP Skin Support!
; Demonstrates how to use the ButtonEx controls and custom skin modification

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
  #Command_Button4
  #Command_Button5
  #Command_Button6
  #Command_Button7
  #Command_Button8
  #Command_Button9
  #Command_Button10
  #Command_Button11
  #Command_Button12
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(5)

; 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\newlogo2_256x256.png", 256, 256, 0), 100, 0, 0, 0, 0, #ImgBlend_DestroyOriginal)
image(2)\normal = LoadImg("icons\dccmanager\downloadpanel_border.png", 0, 0, 0)
image(3)\normal = LoadImg("icons\advanced.ico", 32, 32, 0)
image(3)\hot = ImgBlend(image(3)\normal, 255, 30, 0, 0, 0, 0)
image(3)\pressed = ImgBlend(image(3)\normal, 255, 0, -30, 0, 0, 0)
image(4)\normal = LoadImg("icons\color.ico", 32, 32, 0)
image(4)\hot = ImgBlend(image(4)\normal, 255, 30, 0, 0, 0, 0)
image(4)\pressed = ImgBlend(image(4)\normal, 255, 0, -30, 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)
        
        ; tint the default button skin with a random colour!
        If MenuID = #Command_Button12
          
          r.s = Str(Random(255))
          g.s = Str(Random(255))
          b.s = Str(Random(255))
          skin = GetButtonExSkin(#Command_Button1)
          SetSkinProperty(skin, "buttonex", "normal", "overlay", "rgba("+r+","+g+","+b+", 80)")
          SetSkinProperty(skin, "buttonex", "hot", "overlay", "rgba("+r+","+g+","+b+", 80)")
          SetSkinProperty(skin, "buttonex", "pressed", "overlay", "rgba("+r+","+g+","+b+", 80)")
 
        ; debug output the button ID
        Else
        
          Debug MenuID
          
        EndIf
        
      EndIf
      
    ; resize panelex when main window resized
    Case #WM_SIZE
      
      MoveWindow_(PanelExID(0, -1), 0, 0, WindowWidth(#Window_0), WindowHeight(#Window_0), #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), 0, 0, WindowWidth(#Window_0), WindowHeight(#Window_0), 0)
  page = AddPanelExImagePage(2, image(1)\normal, 0, 0, 0, 0, #PNLX_CENTRE|#PNLX_VCENTRE)
  SetPanelExPageBorder(0, 0, image(2)\normal, -1, 0, 0, 0)
  SetPanelExPageScrolling(0, 0, #PNLX_AUTOSCROLL, #True)
  
  ;- Create a big button
  ButtonEx(page, #Command_Button1, 50, 50, 200, 100, "A Great Big Button!", 0, 0, 0, 0, 0)
  
  ;- Create a button with icon
  ButtonEx(page, #Command_Button2, 50, 160, 160, 32, "Button and Icon", image(0)\normal, image(0)\hot, image(0)\pressed, 0, 0)
  
  ;- Create a semi-transparent button!
  button = ButtonEx(page, #Command_Button3, 50, 202, 160, 60, "Semi-Transparent!", image(0)\normal, image(0)\hot, image(0)\pressed, 0, 0)
  ; Because the ButtonEx is really a subclassed PanelEx with user-callback
  ; we can use the normal PanelEx commands on it's handle and change the alpha transparency! :D
  SetPanelExPageAlpha(button, 0, 100, 0)
  
  ;- Create a button with modified skin
  ; copy system default skin of ButtonEx
  newSkin = CopySkin(GetButtonExSkin(#Command_Button1))
  ; 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\stop.ico")
  ; make the background tile
  SetSkinProperty(newSkin, "buttonex", "hot", "background position", "tile: true")
  ; make text red for hot state and change font and make it bigger (with bold and strikethrough effect)
  SetSkinProperty(newSkin, "buttonex", "hot", "text", "colour: red; font: Verdana, 11, bold, strike")
  ; change mouse cursor for hot state
  SetSkinProperty(newSkin, "buttonex", "hot", "cursor", "hand")
  
  ButtonEx(page, #Command_Button4, 400, 50, 200, 64, "Modified Button Skin", image(0)\normal, image(0)\hot, image(0)\pressed, 0, newSkin)
  
  ;- Create a toggle button
  ToggleButtonEx(page, #Command_Button5, 50, 282, 160, 60, "Toggle Button", image(3)\normal, image(3)\hot, image(3)\pressed, image(4)\normal, image(4)\hot, image(4)\pressed, 0, 0)
  
  ;- Create a sticky toggle button
  ToggleButtonEx(page, #Command_Button6, 50, 352, 160, 60, "Sticky Toggle", image(3)\normal, image(3)\hot, image(3)\pressed, image(4)\normal, image(4)\hot, image(4)\pressed, 0, #BUTTONEX_STICKYSKIN)
  
  ;- Create check box button
  button = CheckButtonEx(page, #Command_Button7, 500, 150, 100, 20, "Check Box", 0)
  
  ;- Create some radio buttons
  RadioButtonEx(page, #Command_Button8, 500, 200, 120, 20, "Radio Button 1", 0)
  RadioButtonEx(page, #Command_Button9, 500, 230, 120, 20, "Radio Button 2", 0)
  RadioButtonEx(page, #Command_Button10, 500, 260, 120, 20, "Radio Button 3", 0)
  RadioButtonEx(page, #Command_Button11, 500, 290, 120, 20, "Radio Button 4", 0)
  
  ;- Create an image button that will tint the system default button skin with a random colour when clicked
  ImageButtonEx(page, #Command_Button12, 500, 360, 0, 0, image(4)\normal, image(4)\hot, image(4)\pressed, 0)
  ; create a nice tooltip for the image button
  ButtonExToolTip(#Command_Button12, "Tint the default button skin with a random colour!")
  
  ; 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 = #PB_Event_CloseWindow

End
It works perfectly on my PC.

Roger
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: ProGUI problem

Post by wombats »

Are you using the 32-bit userlib version of ProGUI? I just tested it and it doesn't have the problem. It seems it's only the 64-bit version that does. I include the ProGUI source directly because there is no userlib version for 64-bit.
RBeausoleil
User
User
Posts: 18
Joined: Tue Aug 20, 2019 6:47 pm

Re: ProGUI problem

Post by RBeausoleil »

Yes I do...

Never tried the 64 bit as I use only the 32 bit version of PureBasic.

Roger
User avatar
X0r
Enthusiast
Enthusiast
Posts: 138
Joined: Tue May 01, 2007 3:49 am
Location: Germany

Re: ProGUI problem

Post by X0r »

I have the same issue when using the ExplorerBar. Using ProGUI as a DLL solves that problem.
Post Reply