IceDesign GUI designer

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
hoangdiemtinh
User
User
Posts: 97
Joined: Wed Nov 16, 2022 1:51 pm

Re: IceDesign GUI designer

Post by hoangdiemtinh »

@ChrisR

Price 19,39$ - How long does this software license last ?

How to donate ?
PC: Windows 10 x64, 8GB RAM. PB ver: 6.x
--
I love PB5 vs PB6 :)
hoangdiemtinh
User
User
Posts: 97
Joined: Wed Nov 16, 2022 1:51 pm

Re: IceDesign GUI designer

Post by hoangdiemtinh »

I get ERROR at file main-win.pb : At least one window should be opened to use this command.
Where did I go wrong?

The main Window and the second Window, have the left image and the logo image, these images are broken, while I make calls to the Window.

main-win.pb

Code: Select all

;- Top
; -----------------------------------------------------------------------------
;           Name:
;    Description:
;         Author:
;           Date: 2024-05-13
;        Version:
;     PB-Version:
;             OS:
;         Credit:
;          Forum:
;     Created by: IceDesign
; -----------------------------------------------------------------------------

CompilerIf #PB_Compiler_IsMainFile
  EnableExplicit
CompilerEndIf

;- Enumerations
Enumeration Window
  #MAIN_WINDOW
EndEnumeration

Enumeration MenuToolStatusBar
  #StatusBar
EndEnumeration

Enumeration Gadgets
  #Btn1_OK_MAIN_WINDOW
  #Check1_CALL_SECOND_WINDOW
  #Check1_CALL_THREE_WINDOW
  #Combo1_MAIN_WINDOW
  #Cont1_MAIN_WINDOW
  #frame1_MAIN_WINDOW
  #image1_LEFT_MAIN_WINDOW
  #image2_HEADER_MAIN_WINDOW
  #panel1_MAIN_WINDOW
  #text1_MAIN_WINDOW
  #text2_MAIN_WINDOW
EndEnumeration

Enumeration Images
  #Imag_logo_MAIN_WINDOW
  #Imag_left_MAIN_WINDOW
EndEnumeration

Enumeration Fonts
  #Font_Arial_14
  #Font_Arial_16
  #Font_Arial_16_B
  #Font_Arial_18_B
EndEnumeration

CompilerIf Not Defined(GadgetImages, #PB_Structure)
  Structure GadgetImages
    Image.i
    PressedImage.i
    Width.i
    Height.i
  EndStructure
CompilerEndIf

;- Load Images
UseJPEGImageDecoder()

CatchImage(#Imag_logo_MAIN_WINDOW, ?Imag_logo_MAIN_WINDOW)
CatchImage(#Imag_left_MAIN_WINDOW, ?Imag_left_MAIN_WINDOW)

;- Load Fonts
LoadFont(#Font_Arial_14, "Arial", 14)
LoadFont(#Font_Arial_16, "Arial", 16)
LoadFont(#Font_Arial_16_B, "Arial", 16, #PB_Font_Bold)
LoadFont(#Font_Arial_18_B, "Arial", 18, #PB_Font_Bold)

;- Declare
CompilerIf Not Defined(GadgetImages, #PB_Structure)
  Declare ResizeGadgetImage(Gadget, OriginalImage, OriginalPressedImage = #PB_Ignore)
CompilerEndIf
Declare Resize_MAIN_WINDOW()
Declare StatusBar_MAIN_WINDOW()
Declare Open_MAIN_WINDOW(X = 0, Y = 0, Width = 1000, Height = 700)

Macro SetTabOrder(Gadget)
  CompilerIf #PB_Compiler_OS = #PB_OS_Windows : SetWindowPos_(GadgetID(Gadget), #HWND_BOTTOM, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE) : CompilerEndIf
EndMacro

CompilerIf Not Defined(ResizeGadgetImage, #PB_Procedure)
  Procedure ResizeGadgetImage(Gadget, OriginalImage, OriginalPressedImage = #PB_Ignore)
    Protected Image, Width, Height
    Static NewMap GadgetImage.GadgetImages()
    
    If IsGadget(Gadget) And IsImage(OriginalImage)
      Width = DesktopScaledX(GadgetWidth(Gadget)) : Height = DesktopScaledY(GadgetHeight(Gadget))
      If Width > 0 And Height > 0
        If GadgetImage(Str(Gadget))\Width <> Width Or GadgetImage(Str(Gadget))\Height <> Height
          GadgetImage()\Width  =  Width :  GadgetImage()\Height =  Height
          
          Image = CopyImage(OriginalImage, #PB_Any)
          If Image
            ResizeImage(Image, Width, Height)
            Select GadgetType(Gadget)
              Case #PB_GadgetType_ButtonImage
                SetGadgetAttribute(Gadget, #PB_Button_Image, ImageID(Image))
              Case #PB_GadgetType_Image
                SetGadgetState(Gadget, ImageID(Image))
            EndSelect
            If GadgetImage()\Image And IsImage(GadgetImage()\Image)
              FreeImage(GadgetImage()\Image)
            EndIf
            GadgetImage()\Image = Image
          EndIf
          
          If GadgetType(Gadget) = #PB_GadgetType_ButtonImage And IsImage(OriginalPressedImage)
            Image = CopyImage(OriginalPressedImage, #PB_Any)
            If Image
              ResizeImage(Image, Width, Height)
              SetGadgetAttribute(Gadget, #PB_Button_PressedImage, ImageID(Image))
              If GadgetImage()\PressedImage And IsImage(GadgetImage()\PressedImage)
                FreeImage(GadgetImage()\PressedImage)
              EndIf
              GadgetImage()\PressedImage = Image
            EndIf
          EndIf
          
        EndIf    ; If GadgetImage(Str(Gadget))\Width <> Width Or GadgetImage(Str(Gadget))\Height <> Height
      EndIf      ; If Width > 0 And Height > 0
    EndIf        ; If IsGadget(Gadget) And IsImage(OriginalImage)
  EndProcedure
CompilerEndIf

Procedure Resize_MAIN_WINDOW()
  Static StatusBarHeight
  Protected MAIN_WINDOW_WidthIni = 1000, MAIN_WINDOW_HeightIni = 700
  Protected panel1_MAIN_WINDOW_WidthIni = 677, panel1_MAIN_WINDOW_HeightIni = 542   ; #PB_Panel_ItemWidth(Height) Attribute
  Protected ScaleX.f, ScaleY.f
  If StatusBarHeight = 0
    StatusBarHeight = StatusBarHeight(#StatusBar)
  EndIf
  MAIN_WINDOW_HeightIni - StatusBarHeight
  
  ScaleX = WindowWidth(#MAIN_WINDOW) / MAIN_WINDOW_WidthIni : ScaleY = (WindowHeight(#MAIN_WINDOW) - StatusBarHeight) / MAIN_WINDOW_HeightIni
  ResizeGadget(#image1_LEFT_MAIN_WINDOW, ScaleX * 0, ScaleY * 0, ScaleX * 300, ScaleY * 675)
  ResizeGadgetImage(#image1_LEFT_MAIN_WINDOW, #Imag_left_MAIN_WINDOW)
  ResizeGadget(#Cont1_MAIN_WINDOW, ScaleX * 310, ScaleY * 0, ScaleX * 685, ScaleY * 80)
  ResizeGadget(#image2_HEADER_MAIN_WINDOW, ScaleX * 310, ScaleY * 0, ScaleX * 80, ScaleY * 80)
  ResizeGadgetImage(#image2_HEADER_MAIN_WINDOW, #Imag_logo_MAIN_WINDOW)
  ResizeGadget(#text1_MAIN_WINDOW, ScaleX * 460, ScaleY * 0, ScaleX * 460, ScaleY * 30)
  ResizeGadget(#panel1_MAIN_WINDOW, ScaleX * 310, ScaleY * 90, ScaleX * 685, ScaleY * 580)
  ScaleX = GetGadgetAttribute(#panel1_MAIN_WINDOW, #PB_Panel_ItemWidth) / panel1_MAIN_WINDOW_WidthIni : ScaleY = GetGadgetAttribute(#panel1_MAIN_WINDOW, #PB_Panel_ItemHeight) / panel1_MAIN_WINDOW_HeightIni
  ResizeGadget(#frame1_MAIN_WINDOW, ScaleX * 10, ScaleY * 0, ScaleX * 665, ScaleY * 110)
  ResizeGadget(#text2_MAIN_WINDOW, ScaleX * 20, ScaleY * 30, ScaleX * 220, ScaleY * 30)
  ResizeGadget(#Combo1_MAIN_WINDOW, ScaleX * 250, ScaleY * 30, ScaleX * 410, ScaleY * 30)
  ResizeGadget(#Check1_CALL_SECOND_WINDOW, ScaleX * 20, ScaleY * 70, ScaleX * 220, ScaleY * 30)
  ResizeGadget(#Check1_CALL_THREE_WINDOW, ScaleX * 250, ScaleY * 70, ScaleX * 410, ScaleY * 30)
  ResizeGadget(#Btn1_OK_MAIN_WINDOW, ScaleX * 430, ScaleY * 510, ScaleX * 240, ScaleY * 30)
EndProcedure

Procedure StatusBar_MAIN_WINDOW()
  If CreateStatusBar(#StatusBar, WindowID(#MAIN_WINDOW))
    AddStatusBarField(120)
    AddStatusBarField(150)
    AddStatusBarField(#PB_Ignore)
    StatusBarText(#StatusBar, 0, "StatusBar")
    StatusBarText(#StatusBar, 1, "Center", #PB_StatusBar_BorderLess | #PB_StatusBar_Center)
    StatusBarText(#StatusBar, 2, "Right", #PB_StatusBar_Right | #PB_StatusBar_Raised)
  EndIf
EndProcedure

Procedure Open_MAIN_WINDOW(X = 0, Y = 0, Width = 1000, Height = 700)
  If OpenWindow(#MAIN_WINDOW, X, Y, Width, Height, "MAIN WINDOW", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
    SetWindowLongPtr_(WindowID(#MAIN_WINDOW), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(#MAIN_WINDOW), #GWL_EXSTYLE) | #WS_EX_LAYERED)
    SetLayeredWindowAttributes_(WindowID(#MAIN_WINDOW), 0, 230, #LWA_ALPHA)
    SetWindowColor(#MAIN_WINDOW, RGB(0, 0, 0))
    
    StatusBar_MAIN_WINDOW()
    
    ImageGadget(#image1_LEFT_MAIN_WINDOW, 0, 0, 300, 675, ImageID(#Imag_left_MAIN_WINDOW))
    
    ContainerGadget(#Cont1_MAIN_WINDOW, 310, 0, 685, 80)
    SetGadgetColor(#Cont1_MAIN_WINDOW, #PB_Gadget_BackColor, RGB(0, 128, 255))
    CloseGadgetList()   ; #Cont1_MAIN_WINDOW
    ImageGadget(#image2_HEADER_MAIN_WINDOW, 310, 0, 80, 80, ImageID(#Imag_logo_MAIN_WINDOW))
    
    TextGadget(#text1_MAIN_WINDOW, 460, 0, 460, 30, "text1 on MAIN_WINDOW", #PB_Text_Center | #SS_CENTERIMAGE)
    SetGadgetColor(#text1_MAIN_WINDOW, #PB_Gadget_BackColor, RGB(255, 255, 255))
    SetGadgetColor(#text1_MAIN_WINDOW, #PB_Gadget_FrontColor, RGB(255, 128, 0))
    SetGadgetFont(#text1_MAIN_WINDOW, FontID(#Font_Arial_18_B))
    PanelGadget(#panel1_MAIN_WINDOW, 310, 90, 685, 580)
    SetGadgetFont(#panel1_MAIN_WINDOW, FontID(#Font_Arial_16_B))
    
    AddGadgetItem(#panel1_MAIN_WINDOW, -1, "Tab0 MAIN_WINDOW")
    FrameGadget(#frame1_MAIN_WINDOW, 10, 0, 665, 110, "frame1 MAIN_WINDOW")
    SetGadgetFont(#frame1_MAIN_WINDOW, FontID(#Font_Arial_16))
    TextGadget(#text2_MAIN_WINDOW, 20, 30, 220, 30, "text2 MAIN_WINDOW", #SS_CENTERIMAGE)
    SetGadgetFont(#text2_MAIN_WINDOW, FontID(#Font_Arial_14))
    ComboBoxGadget(#Combo1_MAIN_WINDOW, 250, 30, 410, 30)
    AddGadgetItem(#Combo1_MAIN_WINDOW, -1, "Combo1_MAIN_WINDOW")
    SetGadgetState(#Combo1_MAIN_WINDOW, 0)
    SetGadgetFont(#Combo1_MAIN_WINDOW, FontID(#Font_Arial_14))
    CheckBoxGadget(#Check1_CALL_SECOND_WINDOW, 20, 70, 220, 30, "Show second Window")
    SetGadgetFont(#Check1_CALL_SECOND_WINDOW, FontID(#Font_Arial_14))
    CheckBoxGadget(#Check1_CALL_THREE_WINDOW, 250, 70, 410, 30, "Show three Window...")
    SetGadgetFont(#Check1_CALL_THREE_WINDOW, FontID(#Font_Arial_14))
    ButtonGadget(#Btn1_OK_MAIN_WINDOW, 430, 510, 240, 30, "OK!")
    SetGadgetFont(#Btn1_OK_MAIN_WINDOW, FontID(#Font_Arial_14))
    AddGadgetItem(#panel1_MAIN_WINDOW, -1, "Tab1 MAIN_WINDOW")
    CloseGadgetList()   ; #panel1_MAIN_WINDOW
    
    SetTabOrder(#Btn1_OK_MAIN_WINDOW)
    
    BindEvent(#PB_Event_SizeWindow, @Resize_MAIN_WINDOW(), #MAIN_WINDOW)
    PostEvent(#PB_Event_SizeWindow, #MAIN_WINDOW, 0)
    ProcedureReturn #True
  EndIf
EndProcedure

XIncludeFile "second-win.pb"
Open_SECOND_WINDOW()

CompilerIf #PB_Compiler_IsMainFile
  ;- Main Program
  If Open_MAIN_WINDOW()
    ;- Event Loop
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Break
          
          ;-> Event Gadget
        Case #PB_Event_Gadget
          Select EventGadget()
            Case #Check1_CALL_SECOND_WINDOW
              If GetGadgetState(#Check1_CALL_SECOND_WINDOW) = #PB_Checkbox_Checked
                Open_SECOND_WINDOW()
                CloseWindow(#MAIN_WINDOW)
              EndIf
            Case #Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW
              If GetGadgetState(#Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW) = #PB_Checkbox_Checked
                Open_MAIN_WINDOW()
                CloseWindow(#SECOND_WINDOW)
              EndIf
            Case #Check1_CALL_THREE_WINDOW
              MessageRequester("Information", "CheckBox Name : #Check1_CALL_THREE_WINDOW" +#CRLF$+#CRLF$+ "State : " + GetGadgetState(EventGadget()))
            Case #Btn1_OK_MAIN_WINDOW   ; OK!
              MessageRequester("Information", "Button Name : #Btn1_OK_MAIN_WINDOW" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
          EndSelect
          
      EndSelect
    ForEver
  EndIf
CompilerEndIf

;- DataSection
DataSection
  Imag_logo_MAIN_WINDOW: : IncludeBinary "H:\logo.jpg"
  Imag_left_MAIN_WINDOW: : IncludeBinary "H:\left.jpg"
EndDataSection

; IDE Options
; EnableXP
; DPIAware
second-win.pb

Code: Select all

;- Top
; -----------------------------------------------------------------------------
;           Name:
;    Description:
;         Author:
;           Date: 2024-05-13
;        Version:
;     PB-Version:
;             OS:
;         Credit:
;          Forum:
;     Created by: IceDesign
; -----------------------------------------------------------------------------

CompilerIf #PB_Compiler_IsMainFile
  EnableExplicit
CompilerEndIf

;- Enumerations
Enumeration Images_SECOND_WINDOW
  #Imag_logo_SECOND_WINDOW
  #Imag_left_SECOND_WINDOW
EndEnumeration

Enumeration Window_SECOND_WINDOW
  #SECOND_WINDOW
EndEnumeration

Enumeration Gadgets_SECOND_WINDOW
  #Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW
  #Btn2_RETURN_TO_MAIN_WINDOW
  #Combo1_SECOND_WINDOW
  #Cont1_SECOND_WINDOW
  #frame1_SECOND_WIN
  #image1_LEFT_SECOND_WINDOW
  #image2_HEADER_SECOND_WINDOW
  #panel1_SECOND_WINDOW
  #text1_SECOND_WINDOW
  #text2_SECOND_WINDOW
EndEnumeration

CompilerIf Not Defined(GadgetImages, #PB_Structure)
  Structure GadgetImages
    Image.i
    PressedImage.i
    Width.i
    Height.i
  EndStructure
CompilerEndIf

;- Load Images
UseJPEGImageDecoder()

CatchImage(#Imag_logo_SECOND_WINDOW, ?FILE_Imag_logo_SECOND_WINDOW)
CatchImage(#Imag_left_SECOND_WINDOW, ?FILE_Imag_left_SECOND_WINDOW)

;- DataSection
DataSection
  FILE_Imag_logo_SECOND_WINDOW: : IncludeBinary "H:\logo.jpg"
  FILE_Imag_left_SECOND_WINDOW: : IncludeBinary "H:\left.jpg"
EndDataSection

;- Load Fonts
LoadFont(#Font_Arial_14, "Arial", 14)
LoadFont(#Font_Arial_16, "Arial", 16)
LoadFont(#Font_Arial_16_B, "Arial", 16, #PB_Font_Bold)
LoadFont(#Font_Arial_18_B, "Arial", 18, #PB_Font_Bold)

;- Declare
CompilerIf Not Defined(GadgetImages, #PB_Structure)
  Declare ResizeGadgetImage(Gadget, OriginalImage, OriginalPressedImage = #PB_Ignore)
CompilerEndIf
Declare Resize_SECOND_WINDOW()
Declare StatusBar_SECOND_WINDOW()
Declare Open_SECOND_WINDOW(X = 0, Y = 0, Width = 1000, Height = 700)

CompilerIf Not Defined(ResizeGadgetImage, #PB_Procedure)
  Procedure ResizeGadgetImage(Gadget, OriginalImage, OriginalPressedImage = #PB_Ignore)
    Protected Image, Width, Height
    Static NewMap GadgetImage.GadgetImages()

    If IsGadget(Gadget) And IsImage(OriginalImage)
      Width = DesktopScaledX(GadgetWidth(Gadget)) : Height = DesktopScaledY(GadgetHeight(Gadget))
      If Width > 0 And Height > 0
        If GadgetImage(Str(Gadget))\Width <> Width Or GadgetImage(Str(Gadget))\Height <> Height
          GadgetImage()\Width  =  Width :  GadgetImage()\Height =  Height

          Image = CopyImage(OriginalImage, #PB_Any)
          If Image
            ResizeImage(Image, Width, Height)
            Select GadgetType(Gadget)
              Case #PB_GadgetType_ButtonImage
                SetGadgetAttribute(Gadget, #PB_Button_Image, ImageID(Image))
              Case #PB_GadgetType_Image
                SetGadgetState(Gadget, ImageID(Image))
            EndSelect
            If GadgetImage()\Image And IsImage(GadgetImage()\Image)
              FreeImage(GadgetImage()\Image)
            EndIf
            GadgetImage()\Image = Image
          EndIf

          If GadgetType(Gadget) = #PB_GadgetType_ButtonImage And IsImage(OriginalPressedImage)
            Image = CopyImage(OriginalPressedImage, #PB_Any)
            If Image
              ResizeImage(Image, Width, Height)
              SetGadgetAttribute(Gadget, #PB_Button_PressedImage, ImageID(Image))
              If GadgetImage()\PressedImage And IsImage(GadgetImage()\PressedImage)
                FreeImage(GadgetImage()\PressedImage)
              EndIf
              GadgetImage()\PressedImage = Image
            EndIf
          EndIf

        EndIf    ; If GadgetImage(Str(Gadget))\Width <> Width Or GadgetImage(Str(Gadget))\Height <> Height
      EndIf      ; If Width > 0 And Height > 0
    EndIf        ; If IsGadget(Gadget) And IsImage(OriginalImage)
  EndProcedure
CompilerEndIf

Procedure Resize_SECOND_WINDOW()
  Static StatusBarHeight
  Protected SECOND_WINDOW_WidthIni = 1000, SECOND_WINDOW_HeightIni = 700
  Protected panel1_SECOND_WINDOW_WidthIni = 677, panel1_SECOND_WINDOW_HeightIni = 542   ; #PB_Panel_ItemWidth(Height) Attribute
  Protected ScaleX.f, ScaleY.f
  If StatusBarHeight = 0
    StatusBarHeight = StatusBarHeight(#StatusBar)
  EndIf
  SECOND_WINDOW_HeightIni - StatusBarHeight

  ScaleX = WindowWidth(#SECOND_WINDOW) / SECOND_WINDOW_WidthIni : ScaleY = (WindowHeight(#SECOND_WINDOW) - StatusBarHeight) / SECOND_WINDOW_HeightIni
  ResizeGadget(#image1_LEFT_SECOND_WINDOW, ScaleX * 0, ScaleY * 0, ScaleX * 300, ScaleY * 675)
  ResizeGadgetImage(#image1_LEFT_SECOND_WINDOW, #Imag_left_SECOND_WINDOW)
  ResizeGadget(#Cont1_SECOND_WINDOW, ScaleX * 310, ScaleY * 0, ScaleX * 685, ScaleY * 80)
  ResizeGadget(#image2_HEADER_SECOND_WINDOW, ScaleX * 310, ScaleY * 0, ScaleX * 80, ScaleY * 80)
  ResizeGadgetImage(#image2_HEADER_SECOND_WINDOW, #Imag_logo_SECOND_WINDOW)
  ResizeGadget(#text1_SECOND_WINDOW, ScaleX * 460, ScaleY * 0, ScaleX * 460, ScaleY * 30)
  ResizeGadget(#panel1_SECOND_WINDOW, ScaleX * 310, ScaleY * 90, ScaleX * 685, ScaleY * 580)
  ScaleX = GetGadgetAttribute(#panel1_SECOND_WINDOW, #PB_Panel_ItemWidth) / panel1_SECOND_WINDOW_WidthIni : ScaleY = GetGadgetAttribute(#panel1_SECOND_WINDOW, #PB_Panel_ItemHeight) / panel1_SECOND_WINDOW_HeightIni
  ResizeGadget(#frame1_SECOND_WIN, ScaleX * 10, ScaleY * 0, ScaleX * 665, ScaleY * 70)
  ResizeGadget(#text2_SECOND_WINDOW, ScaleX * 20, ScaleY * 30, ScaleX * 170, ScaleY * 30)
  ResizeGadget(#Combo1_SECOND_WINDOW, ScaleX * 220, ScaleY * 30, ScaleX * 420, ScaleY * 30)
  ResizeGadget(#Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW, ScaleX * 250, ScaleY * 510, ScaleX * 160, ScaleY * 30)
  ResizeGadget(#Btn2_RETURN_TO_MAIN_WINDOW, ScaleX * 430, ScaleY * 510, ScaleX * 240, ScaleY * 30)
EndProcedure

Procedure StatusBar_SECOND_WINDOW()
  If CreateStatusBar(#StatusBar, WindowID(#SECOND_WINDOW))
    AddStatusBarField(120)
    AddStatusBarField(150)
    AddStatusBarField(#PB_Ignore)
    StatusBarText(#StatusBar, 0, "StatusBar")
    StatusBarText(#StatusBar, 1, "Center", #PB_StatusBar_BorderLess | #PB_StatusBar_Center)
    StatusBarText(#StatusBar, 2, "Right", #PB_StatusBar_Right | #PB_StatusBar_Raised)
  EndIf
EndProcedure

Procedure Open_SECOND_WINDOW(X = 0, Y = 0, Width = 1000, Height = 700)
  If OpenWindow(#SECOND_WINDOW, X, Y, Width, Height, "SECOND WINDOW", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
      SetWindowColor(#SECOND_WINDOW, RGB(0, 0, 0))

    StatusBar_SECOND_WINDOW()

    ImageGadget(#image1_LEFT_SECOND_WINDOW, 0, 0, 300, 675, ImageID(#Imag_left_SECOND_WINDOW))
      GadgetToolTip(#image1_LEFT_SECOND_WINDOW, "NeMu MuMu from CuuMay.win")
    ContainerGadget(#Cont1_SECOND_WINDOW, 310, 0, 685, 80)
      SetGadgetColor(#Cont1_SECOND_WINDOW, #PB_Gadget_BackColor, RGB(0, 128, 255))
    CloseGadgetList()   ; #Cont1_SECOND_WINDOW
    ImageGadget(#image2_HEADER_SECOND_WINDOW, 310, 0, 80, 80, ImageID(#Imag_logo_SECOND_WINDOW))
      GadgetToolTip(#image2_HEADER_SECOND_WINDOW, "NeMu MuMu from CuuMay.win")
    TextGadget(#text1_SECOND_WINDOW, 460, 0, 460, 30, "text1 on SECOND WINDOW", #PB_Text_Center | #SS_CENTERIMAGE)
      SetGadgetColor(#text1_SECOND_WINDOW, #PB_Gadget_BackColor, RGB(255, 255, 255))
      SetGadgetColor(#text1_SECOND_WINDOW, #PB_Gadget_FrontColor, RGB(255, 128, 0))
      SetGadgetFont(#text1_SECOND_WINDOW, FontID(#Font_Arial_18_B))
    PanelGadget(#panel1_SECOND_WINDOW, 310, 90, 685, 580)
      SetGadgetFont(#panel1_SECOND_WINDOW, FontID(#Font_Arial_16_B))
      GadgetToolTip(#panel1_SECOND_WINDOW, "Chọn thao tác")
      AddGadgetItem(#panel1_SECOND_WINDOW, -1, "Tab0 SECOND")
      FrameGadget(#frame1_SECOND_WIN, 10, 0, 665, 70, "frame1 SECOND")
        SetGadgetFont(#frame1_SECOND_WIN, FontID(#Font_Arial_16))
      TextGadget(#text2_SECOND_WINDOW, 20, 30, 170, 30, "text2 SECOND", #SS_CENTERIMAGE)
        SetGadgetFont(#text2_SECOND_WINDOW, FontID(#Font_Arial_14))
      ComboBoxGadget(#Combo1_SECOND_WINDOW, 220, 30, 420, 30)
        AddGadgetItem(#Combo1_SECOND_WINDOW, -1, "Combo1_SECOND_WINDOW")
        SetGadgetState(#Combo1_SECOND_WINDOW, 0)
        SetGadgetFont(#Combo1_SECOND_WINDOW, FontID(#Font_Arial_14))
      ButtonGadget(#Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW, 250, 510, 160, 30, "Save and return")
        SetGadgetFont(#Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW, FontID(#Font_Arial_14))
      ButtonGadget(#Btn2_RETURN_TO_MAIN_WINDOW, 430, 510, 240, 30, "<-- Return to Main window")
        SetGadgetFont(#Btn2_RETURN_TO_MAIN_WINDOW, FontID(#Font_Arial_14))
      AddGadgetItem(#panel1_SECOND_WINDOW, -1, "Tab1 SECOND")
    CloseGadgetList()   ; #panel1_SECOND_WINDOW

    SetTabOrder(#Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW) : SetTabOrder(#Btn2_RETURN_TO_MAIN_WINDOW)

    BindEvent(#PB_Event_SizeWindow, @Resize_SECOND_WINDOW(), #SECOND_WINDOW)
    PostEvent(#PB_Event_SizeWindow, #SECOND_WINDOW, 0)
    ProcedureReturn #True
  EndIf
EndProcedure

; IDE Options
; EnableXP
; DPIAware
PC: Windows 10 x64, 8GB RAM. PB ver: 6.x
--
I love PB5 vs PB6 :)
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

Back from a week's vacation...
hoangdiemtinh wrote: Mon May 13, 2024 5:56 am Where did I go wrong?
Hi hoangdiemtinh, do not rename enumeration names in second-win.pb.

Code: Select all

Enumeration Images_SECOND_WINDOW
Enumeration Window_SECOND_WINDOW
Enumeration Gadgets_SECOND_WINDOW
==> must remain
Enumeration Images
Enumeration Window
Enumeration Gadgets
Otherwise constants #MAIN_WINDOW and #SECOND_WINDOW have the same value: 0. The same applies to enumeration gadgets and images.
The enumeration name work as a counter, extract from enumerations help
A name can be set to identify an enumeration and allow to continue it later. It is useful to group objects altogether while declaring them in different code place.
#
And for returning to the main window, remove the "If GetGadgetState()" :

Code: Select all

Case #Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW, #Btn2_RETURN_TO_MAIN_WINDOW
  ;If GetGadgetState(#Btn1_SAVE_AND_RETURN_TO_MAIN_WINDOW) = #PB_Checkbox_Checked ; <==
    Open_MAIN_WINDOW()
    CloseWindow(#SECOND_WINDOW)
  ;EndIf ; <==
#
hoangdiemtinh wrote: Fri May 10, 2024 1:28 pm Price 19,39$ - How long does this software license last ?

How to donate ?
The license is just like Purebasic, with no subscriptions or additional costs for updates 8)
It is possible to donate, if you wish, there's a link at the bottom of the 1st post, Paypal Donation page.
But don't forget to make a donation to Fred first, on purebasic.com login > Support. :wink:
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

Michael Vogel wrote: Mon May 06, 2024 6:56 pm Chris, I like your IceDesigner, thank you for your work.

I would be able to write a list of thousand feature requests:
- a zoom 200%-function for precise editing
- a configurable offset for duplicate/paste (or additional duplicate below and duplicate right functions)
- editable default prefixes instead of the static #Window_, #Txt_, #Edit_, #String_,...
- and 997 more :lol:
Hi Michael, Thanks :)
The x2 zoom function is an idea that has already crossed my mind, no rounding problems with *2 and /2
But it has to be done just about everywhere, so it's not actually done, but it's still a good idea, especially for HiDpi screens

Not sure for the configurable offset for duplicate/paste, when pasted, they are pre-selected, ready to be repositioned. The current 10x10 OffSet is just to see them better.

I'm noted it for the editable default prefixes.
If I do it, it will probably be in a new section of IceDesign.ini, easier to change using notepad so probably without any specific interface, as for the Title block.
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

Michael Vogel wrote: Mon May 06, 2024 6:56 pm I'd like to lock the height of all buttons and button #1 should also keep it's width. Only the width of button #2 and #3 should be resized to fill the space when changing the window size.
I also think you can do it through a Container as suggested by Caronte3D here
He knows it well and has been a great help with ideas and testing :)
Michael Vogel wrote: Mon May 06, 2024 6:56 pm Some flickering is given, not sure, if this could be done a little bit better when using the IceDesigner only.
Not much can be done on the Designer side, too many different cases, unfortunately it's Windows :wink:
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

IceDesign has been updated in version 2.1.4

It is possible to customize the position of cloned or copy-paste gadgets, taking into account the height and/or width of duplicated gadget(s) and an X/Y offset. It also works with multiple selections, the height/width is the selection one. See screen below

Image

In addition to “Add Window name”, prefixes and sufixes (previously “.i” and not really useful) have been changed and they are now available for both variables and constants. See screen above
You can either assemble them or use only one of them.

After a 1st run, the default short control names are now customizable in IceDesign.ini. To be used with “Use Short Name for Controls” option in setting.
IceDesign.ini

Code: Select all

[ControlsShortName]
Button = Bouton
CheckBox = Check
...

It is now compiled with PB 6.10 and VS linker
:)

Edit: I've made a tiny adjustment just now, you can redownload it again, sorry.
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: IceDesign GUI designer

Post by le_magn »

Thank's ChrisR :) :D
Image
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

IceDesign has been updated in version 2.1.5

Add an option to choose the order of concatenation between ShortWindowName, Prefix and Suffix for Gadget names:

Image
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: IceDesign GUI designer

Post by le_magn »

Thank's Chris!!! I have a feature request: is possible to add option fo select transparent background for gadget, for example for the text gadget, previous in older purebasic version i used pureform with purelibrary from gnozal, and it have this feature, please add it in future version of icedesign, thank you..
Image
williamvanhoecke
User
User
Posts: 65
Joined: Wed Jun 07, 2017 10:13 pm

Re: IceDesign GUI designer

Post by williamvanhoecke »

Chris,
I updated to 2.1.5 but unfortunatly now i have this huge problem because you have changed the concept of constant naming so that the old ways is no longer possible.

fi
Enumeration Gadgets
#Gadget_WinSymCommandFusebox_BtnImg_SizeU ----------2.1.5---> #WinSymCommandFusebox_BtnImg_SizeU
#Gadget_WinSymCommandFusebox_String_Scalenumber ---2.1.5---> #WinSymCommandFusebox_String_Scalenumber
#Gadget_WinSymCommandFusebox_Txt_ZekeringkastNAAM -2.1.5-> #WinSymCommandFusebox_Txt_ZekeringkastNAAM
#Gadget_WinSymCommandFusebox_ListView_volgnr ---------2.1.5--> #WinSymCommandFusebox_ListView_volgnr
EndEnumeration

Enumeration Image
#Imag_WinSymCommandFusebox_jobup ---------2.1.5--> #WinSymCommandFusebox_Imag_jobup
#Imag_WinSymCommandFusebox_jobdwn ---------2.1.5-->#WinSymCommandFusebox_Imag_jobdwn
EndEnumeration

There is NO WAY to tweak the 'code options' to get the same result as with version 2.1.1
As a result EVERY REFERENCE to any gadget, image etc... I coded before is now failing ?? Even recompiling ALL windows will not solve this.

Should updates not be downword compatible ??
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

@le_magn
I don't know purelibrary from gnozal !
A screenshot would be appreciated, to understand what this library offered.
Currently, there's an option "Window Transaprency" in the settings to adjust the transparency of the entire window with its gadgets.
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

@williamvanhoecke
williamvanhoecke wrote: Mon May 27, 2024 12:10 am Should updates not be downword compatible ??
Yes, I'm a bit confused about that.
Replacing “Window_Main” with “Gadget_Main” wasn't really satisfactory and didn't suit everyone. I was asked about its usefulness and why I added “Gadget” without it being requested by the user.
It's now fully customizable, with the short Window name, Prefix and Suffix and the order in which to concatenate them. For both variables and constants.
But I understand that it's not great for backwards compatibility :oops:

For the Gadgets names, you should be able to find the same names with "Add Window Name" enabled and "Gadget_" as Prefix and by choosing "Prefix+WinName+Gadget+Suffix" for the concatenation order. It should be good.
But unfortunately you'll also get the “Gadget_” prefix for images.
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

@blueb
I have received an email notification "IceDesign stuff" but I can't read it, is this normal?
You are not authorised to read private messages that are on hold.
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: IceDesign GUI designer

Post by Kiffi »

@ChrisR: Your inbox is full. For this reason, new messages are being held back. You need to archive or delete some of your messages and then release the messages that have been held back.
Hygge
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign GUI designer

Post by ChrisR »

Thanks Kiffy, the message is not really explicit but never mind, I'll get the broom.
Post Reply