Page 22 of 71

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Mon Apr 18, 2011 5:35 pm
by X0r
After including ProGUI.pb the crash does not occur anymore.
Now is this positive or negative, I do not know. :?

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Mon Apr 18, 2011 5:49 pm
by PrincieD
Forge wrote:After including ProGUI.pb the crash does not occur anymore.
Now is this positive or negative, I do not know. :?
hmm is it possible that you were compiling with an old version of the ProGUI userlib in your PB folder?

Chris.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Tue Apr 19, 2011 4:45 am
by PrincieD
Hey guys! this is a small example of the new skin file format :) : -

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<Skin>
   <Name id="test"/>
   <Component id="buttonex">
      <State id="normal">
         <Property id="background">
            black
         </Property>
         <Property id="background image">
            test.ico; width: 128; height: 128;
         </Property>
      </State>
   </Component>
</Skin>
This was generated with the following new ProGUI work-in-progress API commands: -

Code: Select all

skin = CreateSkin("test")
SetSkinProperty(skin, "buttonex", "normal", "background", "black")
SetSkinProperty(skin, "buttonex", "normal", "background image", "test.ico; width: 128; height: 128;")
SaveSkin(skin, "test.skn", 0)

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Fri Apr 22, 2011 8:01 pm
by Zach
Is this related to the full window skinning I was asking about earlier? :idea:


Or is it just a redesign of your current system?

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Fri Apr 22, 2011 8:16 pm
by PrincieD
Zach wrote:Is this related to the full window skinning I was asking about earlier? :idea:

Or is it just a redesign of your current system?
Hi Zach,

It's both, the new skin subsystem is extremely flexible and I designed it with full window skinning in mind (but this will be coming later). At the moment just the controls will be skinned though.

Chris.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Wed Apr 27, 2011 4:02 pm
by Poshu
Is there any way to change the the rebar's gadget position (In order to save user's layout)?

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Wed Apr 27, 2011 5:49 pm
by PrincieD
Poshu wrote:Is there any way to change the the rebar's gadget position (In order to save user's layout)?
Hey Poshu, I'll be adding this functionality to the new release but if you need it urgently check out RB_SETBANDINFO and RB_SETBANDWIDTH on MSDN: http://msdn.microsoft.com/en-us/library ... S.85).aspx

Chris.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Wed Apr 27, 2011 6:34 pm
by PrincieD
I've made so that the image border rect and border background mask image are automatically generated from the single border image now by default (instead of having to do it by hand in your image editing software), very quick and nifty algorithm! and will make creating/editing skins a lot quicker :D

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Thu May 05, 2011 12:20 pm
by AndyMK
Is there any way to position a rebar inside a window? At the moment it defaults to top left.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Thu May 05, 2011 12:54 pm
by PrincieD
AndyMK wrote:Is there any way to position a rebar inside a window? At the moment it defaults to top left.
Hi Andy,

If you pass the #CCS_NOPARENTALIGN constant to the style parameter of the Rebar should work, then use MoveWindow_() with the Rebar handle.
This might not work though because the Rebar will always try and stretch to the width of the parent window, to get around this you can place the Rebar in a single paged PanelEx and then position the PanelEx inside the window.

Chris.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Thu May 05, 2011 1:20 pm
by AndyMK
Thanks, ill give it a go :) Any news on updates? I still can't display black menu's with the 2007 style.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Thu May 05, 2011 1:34 pm
by PrincieD
AndyMK wrote:Thanks, ill give it a go :) Any news on updates? I still can't display black menu's with the 2007 style.
I'm going to try and push for a release this Sunday but it may be next week, just finishing off the ButtonEx and then a few other things that need sorting. (the docs are gunna need quite a bit of updating too! ;))

Chris.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Thu May 05, 2011 3:45 pm
by AndyMK
I cant seem to create a toolbar+rebar inside a panelex. I am using the image below as a surround for a rebar toolbar.

Back.png
Image

Here is the code to display the alpha window.

Code: Select all

#AC_SRC_OVER = $0
#AC_SRC_ALPHA = $1
#ULW_ALPHA = $2


Macro WindowAlphaInit(WindowNr)
   SetWindowLongPtr_(WindowID(WindowNr), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(WindowNr), #GWL_EXSTYLE) | #WS_EX_LAYERED)
EndMacro

Macro WindowAlphaColor(WindowNr, Color)
   SetLayeredWindowAttributes_(WindowID(WindowNr), Color, 0, #LWA_COLORKEY)
EndMacro

Procedure WindowAlphaImage(WindowNr, ImageNr, Alpha=$FF)
   Protected ImageID, X, Y, Width, Height
   Protected hDC, bmi.BITMAPINFO, pt.POINT, Blend.BLENDFUNCTION
   Protected Color, R, G, B, A
   Protected Result = #False

   If IsImage(ImageNr) = 0 Or ImageDepth(ImageNr) <> 32 : ProcedureReturn Result : EndIf


   ImageID = ImageID(ImageNr)
   Width = ImageWidth(ImageNr)
   Height = ImageHeight(ImageNr)

   ; Precalculate scale:
   Protected Dim Scale.f($FF)
   For X = 0 To $FF
      Scale(X) = X / $FF
   Next

   ; Prepare array size:
   Protected Dim Image.l(Width - 1, Height - 1)


   hDC = StartDrawing(ImageOutput(ImageNr))
   If hDC
      With bmi\bmiHeader
         \biSize = SizeOf(BITMAPINFOHEADER)
         \biWidth = Width
         \biHeight = Height
         \biPlanes = 1
         \biBitCount = 32
         \biCompression = #BI_RGB
      EndWith

      GetDIBits_(hDC, ImageID, 0, Height, @Image(), @bmi, #DIB_RGB_COLORS)  ; Copy image to memory

      ; Modify memory:
      For Y = 0 To Height - 1
         For X = 0 To Width - 1
            Color = Image(X, Y)
            A = Alpha(Color)
            If A < $FF
               R = Red(Color) * Scale(A)
               G = Green(Color) * Scale(A)
               B = Blue(Color) * Scale(A)
               Image(X, Y) = RGBA(R, G, B, A)
            EndIf
         Next
      Next

      SetDIBits_(hDC, ImageID, 0, Height, @Image(), @bmi, #DIB_RGB_COLORS)  ; Copy memory back to image


      ; Set image to window background:
      With Blend
         \BlendOp = #AC_SRC_OVER
         \BlendFlags = 0
         \SourceConstantAlpha = Alpha
         \AlphaFormat = #AC_SRC_ALPHA
      EndWith

      Result = UpdateLayeredWindow_(WindowID(WindowNr), #Null, #Null, @bmi + SizeOf(Long), hDC, @pt, 0, @Blend, #ULW_ALPHA)

      StopDrawing()
   EndIf

   ProcedureReturn Result
EndProcedure

Procedure MainCallback(hWnd, uMsg, wParam, lParam)
   Protected Result = #PB_ProcessPureBasicEvents       

   Select uMsg               
      Case #WM_SIZE, #WM_MOVE, #WM_PAINT         
         ResizeWindow(0, WindowX(1), WindowY(1), #PB_Ignore, #PB_Ignore)  ; Synchronize both windows
   EndSelect   

   ProcedureReturn Result
EndProcedure


UsePNGImageDecoder()

LoadImage(123,"back.png")

   If OpenWindow(0, 0, 0, ImageWidth(123), ImageHeight(123), "Alpha Window Test", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_ScreenCentered)  ; Just has the image
      WindowAlphaInit(0)
      WindowAlphaImage(0, 123)

      If OpenWindow(1, 0, 0, ImageWidth(123), ImageHeight(123), "", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_ScreenCentered, WindowID(0))  ; Just has all gadgets etc.
         SetWindowColor(1, $FF00FF)
         WindowAlphaInit(1)
         WindowAlphaColor(1, $FF00FF)

         ButtonGadget(3, (ImageWidth(123) - 150) / 2, (ImageHeight(123) - 30) / 2, 150, 30, "Close window")  ; Button centered to the image

         SetWindowCallback(@MainCallback(), 1)

         HideWindow(0, #False)
         HideWindow(1, #False)


         Repeat
            Select WaitWindowEvent()
               Case #PB_Event_Gadget
                  If EventGadget() = 3
                     Break
                  EndIf
               Case #WM_LBUTTONDOWN
                  SendMessage_(WindowID(1), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
            EndSelect
         ForEver
      EndIf
   EndIf

Any pointers on how i would go about it? When i create the toolbar and rebar, it sits at the top left of the screen. I can create a panelex and center it how i want but the rebar/tool bar wont sit inside it.

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Thu May 05, 2011 7:38 pm
by PrincieD
AndyMK wrote:I cant seem to create a toolbar+rebar inside a panelex. I am using the image below as a surround for a rebar toolbar.

Any pointers on how i would go about it? When i create the toolbar and rebar, it sits at the top left of the screen. I can create a panelex and center it how i want but the rebar/tool bar wont sit inside it.
Hi Andy,

I've modified your code demonstrating how to do it :)

Code: Select all

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


;- Gadget Constants
Enumeration
  #MENU_0
  #MENU_1
  #REBAR_0
  #PopupMenu_0
  #TOOLBAR_0
EndEnumeration


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

; load in some example icons
; a more efficient way to load your icon images is to have them
; stored in your exe's resource, in order to load them use the following line:
; image = LoadImage_(GetModuleHandle_(0), "name of icon in resource", #IMAGE_ICON, 16, 16, 0)
; doing this allows you to choose the size of icon stored in the ico file too.
image(0)\normal = LoadImage_(GetModuleHandle_(0), "icons\cut.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(0)\hot = LoadImage_(GetModuleHandle_(0), "icons\cut_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(0)\disabled = LoadImage_(GetModuleHandle_(0), "icons\cut_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(1)\normal = LoadImage_(GetModuleHandle_(0), "icons\paste.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(1)\hot = LoadImage_(GetModuleHandle_(0), "icons\paste_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(1)\disabled = LoadImage_(GetModuleHandle_(0), "icons\paste_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(2)\normal = LoadImage_(GetModuleHandle_(0), "icons\image.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(2)\hot = LoadImage_(GetModuleHandle_(0), "icons\image_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(2)\disabled = LoadImage_(GetModuleHandle_(0), "icons\image_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(3)\normal = LoadImage_(GetModuleHandle_(0), "icons\multimedia.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(3)\hot = LoadImage_(GetModuleHandle_(0), "icons\multimedia_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(3)\disabled = LoadImage_(GetModuleHandle_(0), "icons\multimedia_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(4)\normal = LoadImage_(GetModuleHandle_(0), "icons\package.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(4)\hot = LoadImage_(GetModuleHandle_(0), "icons\package_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(4)\disabled = LoadImage_(GetModuleHandle_(0), "icons\package_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(5)\normal = LoadImage_(GetModuleHandle_(0), "icons\preferences.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(5)\hot = LoadImage_(GetModuleHandle_(0), "icons\preferences_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(5)\disabled = LoadImage_(GetModuleHandle_(0), "icons\preferences_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(6)\normal = LoadImage_(GetModuleHandle_(0), "icons\jump.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(6)\hot = LoadImage_(GetModuleHandle_(0), "icons\jump_h.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)
image(6)\disabled = LoadImage_(GetModuleHandle_(0), "icons\jump_d.ico", #IMAGE_ICON, 16, 16, #LR_LOADFROMFILE)

image(19)\normal = LoadImage_(GetModuleHandle_(0), "icons\copy doc.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(19)\hot = LoadImage_(GetModuleHandle_(0), "icons\copy doc_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(19)\disabled = LoadImage_(GetModuleHandle_(0), "icons\copy doc_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(20)\normal = LoadImage_(GetModuleHandle_(0), "icons\computer on.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(20)\hot = LoadImage_(GetModuleHandle_(0), "icons\computer on_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(20)\disabled = LoadImage_(GetModuleHandle_(0), "icons\computer on_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(21)\normal = LoadImage_(GetModuleHandle_(0), "icons\search.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(21)\hot = LoadImage_(GetModuleHandle_(0), "icons\search_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(21)\disabled = LoadImage_(GetModuleHandle_(0), "icons\search_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)


image(7)\normal = LoadImage_(GetModuleHandle_(0), "icons\advanced.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(7)\hot = LoadImage_(GetModuleHandle_(0), "icons\advanced_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(7)\disabled = LoadImage_(GetModuleHandle_(0), "icons\advanced_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(8)\normal = LoadImage_(GetModuleHandle_(0), "icons\back_alt.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(8)\hot = LoadImage_(GetModuleHandle_(0), "icons\back_alt_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(8)\disabled = LoadImage_(GetModuleHandle_(0), "icons\back_alt_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(9)\normal = LoadImage_(GetModuleHandle_(0), "icons\color.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(9)\hot = LoadImage_(GetModuleHandle_(0), "icons\color_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(9)\disabled = LoadImage_(GetModuleHandle_(0), "icons\color_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(10)\normal = LoadImage_(GetModuleHandle_(0), "icons\computer on.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(10)\hot = LoadImage_(GetModuleHandle_(0), "icons\computer on_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(10)\disabled = LoadImage_(GetModuleHandle_(0), "icons\computer on_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(11)\normal = LoadImage_(GetModuleHandle_(0), "icons\copy doc.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(11)\hot = LoadImage_(GetModuleHandle_(0), "icons\copy doc_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(11)\disabled = LoadImage_(GetModuleHandle_(0), "icons\copy doc_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(12)\normal = LoadImage_(GetModuleHandle_(0), "icons\movies.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(12)\hot = LoadImage_(GetModuleHandle_(0), "icons\movies_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(12)\disabled = LoadImage_(GetModuleHandle_(0), "icons\movies_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(13)\normal = LoadImage_(GetModuleHandle_(0), "icons\new archive.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(13)\hot = LoadImage_(GetModuleHandle_(0), "icons\new archive_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(13)\disabled = LoadImage_(GetModuleHandle_(0), "icons\new archive_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(14)\normal = LoadImage_(GetModuleHandle_(0), "icons\new doc.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(14)\hot = LoadImage_(GetModuleHandle_(0), "icons\new doc_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(14)\disabled = LoadImage_(GetModuleHandle_(0), "icons\new doc_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(15)\normal = LoadImage_(GetModuleHandle_(0), "icons\refresh.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(15)\hot = LoadImage_(GetModuleHandle_(0), "icons\refresh_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(15)\disabled = LoadImage_(GetModuleHandle_(0), "icons\refresh_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(16)\normal = LoadImage_(GetModuleHandle_(0), "icons\search.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(16)\hot = LoadImage_(GetModuleHandle_(0), "icons\search_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(16)\disabled = LoadImage_(GetModuleHandle_(0), "icons\search_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(17)\normal = LoadImage_(GetModuleHandle_(0), "icons\stop.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(17)\hot = LoadImage_(GetModuleHandle_(0), "icons\stop_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(17)\disabled = LoadImage_(GetModuleHandle_(0), "icons\stop_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)

image(18)\normal = LoadImage_(GetModuleHandle_(0), "icons\music 2.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(18)\hot = LoadImage_(GetModuleHandle_(0), "icons\music 2_h.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)
image(18)\disabled = LoadImage_(GetModuleHandle_(0), "icons\music 2_d.ico", #IMAGE_ICON, 32, 32, #LR_LOADFROMFILE)


#AC_SRC_OVER = $0
#AC_SRC_ALPHA = $1
#ULW_ALPHA = $2


Macro WindowAlphaInit(WindowNr)
   SetWindowLongPtr_(WindowID(WindowNr), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(WindowNr), #GWL_EXSTYLE) | #WS_EX_LAYERED)
EndMacro

Macro WindowAlphaColor(WindowNr, Color)
   SetLayeredWindowAttributes_(WindowID(WindowNr), Color, 0, #LWA_COLORKEY)
EndMacro

Procedure WindowAlphaImage(WindowNr, ImageNr, Alpha=$FF)
   Protected ImageID, X, Y, Width, Height
   Protected hDC, bmi.BITMAPINFO, pt.POINT, Blend.BLENDFUNCTION
   Protected Color, R, G, B, A
   Protected Result = #False

   If IsImage(ImageNr) = 0 Or ImageDepth(ImageNr) <> 32 : ProcedureReturn Result : EndIf


   ImageID = ImageID(ImageNr)
   Width = ImageWidth(ImageNr)
   Height = ImageHeight(ImageNr)

   ; Precalculate scale:
   Protected Dim Scale.f($FF)
   For X = 0 To $FF
      Scale(X) = X / $FF
   Next

   ; Prepare array size:
   Protected Dim Image.l(Width - 1, Height - 1)


   hDC = StartDrawing(ImageOutput(ImageNr))
   If hDC
      With bmi\bmiHeader
         \biSize = SizeOf(BITMAPINFOHEADER)
         \biWidth = Width
         \biHeight = Height
         \biPlanes = 1
         \biBitCount = 32
         \biCompression = #BI_RGB
      EndWith

      GetDIBits_(hDC, ImageID, 0, Height, @Image(), @bmi, #DIB_RGB_COLORS)  ; Copy image to memory

      ; Modify memory:
      For Y = 0 To Height - 1
         For X = 0 To Width - 1
            Color = Image(X, Y)
            A = Alpha(Color)
            If A < $FF
               R = Red(Color) * Scale(A)
               G = Green(Color) * Scale(A)
               B = Blue(Color) * Scale(A)
               Image(X, Y) = RGBA(R, G, B, A)
            EndIf
         Next
      Next

      SetDIBits_(hDC, ImageID, 0, Height, @Image(), @bmi, #DIB_RGB_COLORS)  ; Copy memory back to image


      ; Set image to window background:
      With Blend
         \BlendOp = #AC_SRC_OVER
         \BlendFlags = 0
         \SourceConstantAlpha = Alpha
         \AlphaFormat = #AC_SRC_ALPHA
      EndWith

      Result = UpdateLayeredWindow_(WindowID(WindowNr), #Null, #Null, @bmi + SizeOf(Long), hDC, @pt, 0, @Blend, #ULW_ALPHA)

      StopDrawing()
   EndIf

   ProcedureReturn Result
EndProcedure

Procedure MainCallback(hWnd, uMsg, wParam, lParam)
   Protected Result = #PB_ProcessPureBasicEvents       

   Select uMsg               
      Case #WM_SIZE, #WM_MOVE, #WM_PAINT         
         ResizeWindow(0, WindowX(1), WindowY(1), #PB_Ignore, #PB_Ignore)  ; Synchronize both windows
   EndSelect   

   ProcedureReturn Result
EndProcedure


UsePNGImageDecoder()

LoadImage(123,"back.png")

   If OpenWindow(0, 0, 0, ImageWidth(123), ImageHeight(123), "Alpha Window Test", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_ScreenCentered)  ; Just has the image
      WindowAlphaInit(0)
      WindowAlphaImage(0, 123)

      If OpenWindow(1, 0, 0, ImageWidth(123), ImageHeight(123), "", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_ScreenCentered, WindowID(0))  ; Just has all gadgets etc.
         SetWindowColor(1, $FF00FF)
         WindowAlphaInit(1)
         WindowAlphaColor(1, $FF00FF)

         ButtonGadget(3, (ImageWidth(123) - 150) / 2, (ImageHeight(123) - 30) / 2, 150, 30, "Close window")  ; Button centered to the image
         
         ; create panelex
         panelex = CreatePanelEx(0, WindowID(1), 0, 0, 200, 200, 0)
         page = AddPanelExPage(-1)
         
         ; create toolbar
          toolbar = CreateToolBarEx(#TOOLBAR_0, page, 32, 32, #TBSTYLE_HIDECLIPPEDBUTTONS)
          
          ToolBarImageButtonEx(0, "Preferences", image(7)\normal, image(7)\hot, image(7)\disabled, #BTNS_AUTOSIZE|#BTNS_CHECKGROUP)
          SelectToolbarExButton(#TOOLBAR_0, 0, 1)
          ToolBarImageButtonEx(2, "Back", image(8)\normal, image(8)\hot, image(8)\disabled, #BTNS_AUTOSIZE|#BTNS_CHECKGROUP)
          ToolBarImageButtonEx(3, "Colours", image(9)\normal, image(9)\hot, image(9)\disabled, #BTNS_AUTOSIZE|#BTNS_CHECKGROUP)
          ToolBarImageButtonEx(4, "", 0, 0, 0, #BTNS_SEP)
          ToolBarImageButtonEx(5, "Computer", image(10)\normal, image(10)\hot, image(10)\disabled, #BTNS_AUTOSIZE)
          ToolBarImageButtonEx(6, "Copy Document", image(11)\normal, image(11)\hot, image(11)\disabled, #BTNS_AUTOSIZE)
          ToolBarImageButtonEx(7, "Movies", image(12)\normal, image(12)\hot, image(12)\disabled, #BTNS_AUTOSIZE)
          ToolBarImageButtonEx(8, "Archive", image(13)\normal, image(13)\hot, image(13)\disabled, #BTNS_AUTOSIZE) 
          ToolBarImageButtonEx(9, "New Document", image(14)\normal, image(14)\hot, image(14)\disabled, #BTNS_AUTOSIZE)
          ToolBarDropdownImageButtonEx(10, popupmenu, "Refresh", image(15)\normal, image(15)\hot, image(15)\disabled, #BTNS_AUTOSIZE|#BTNS_WHOLEDROPDOWN)
          ToolBarImageButtonEx(11, "", 0, 0, 0, #BTNS_SEP)
          ToolBarImageButtonEx(12, "Search", image(16)\normal, image(16)\hot, image(16)\disabled, #BTNS_AUTOSIZE|#BTNS_CHECK)
          ToolBarImageButtonEx(13, "Stop", image(17)\normal, image(17)\hot, image(17)\disabled, #BTNS_AUTOSIZE)
          ToolBarImageButtonEx(14, "Music", image(18)\normal, image(18)\hot, image(18)\disabled, #BTNS_AUTOSIZE)
          
          DisableToolbarExButton(#TOOLBAR_0, 6, 1)
          DisableToolbarExButton(#TOOLBAR_0, 7, 1)
          
          ; create a rebar
          CreateRebar(#REBAR_0, page, 0, #RBS_VARHEIGHT | #RBS_BANDBORDERS, 0)
          AddRebarGadget(toolbar, "", 620, 0, 0, 0, #RBBS_BREAK|#RBBS_CHILDEDGE|#RBBS_USECHEVRON)
          
          ; resize panelex to rebar height
          MoveWindow_(panelex, 30, 30, 200, RebarHeight(#REBAR_0), #True)
          
         
         SetWindowCallback(@MainCallback(), 1)

         HideWindow(0, #False)
         HideWindow(1, #False)


         Repeat
            Select WaitWindowEvent()
               Case #PB_Event_Gadget
                  If EventGadget() = 3
                     Break
                  EndIf
               Case #WM_LBUTTONDOWN
                  SendMessage_(WindowID(1), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
            EndSelect
         ForEver
      EndIf
   EndIf

Re: ProGUI V1.18! User Interface Library (New PanelEx Scroll

Posted: Fri May 06, 2011 12:03 am
by AndyMK
Thank you :D