It is currently Thu Jul 18, 2019 3:47 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 87 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Simple PropertyGrid
PostPosted: Mon May 21, 2012 8:09 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2917
Location: Planet Earth
Simple PropertyGridGadget using ScrollAreaGadget and PureBasic's Gadgets.

It is very easy to use the PropertyGridGadget:
Code:
prop1 = PropertyGridGadget(Nr,x,y,width,height) ; optional background/front colors and flags for the ScrollAreaGadget (for example border style)

section = AddSection(prop1,"sectionName") ; optional 'open' state: 0 or 1, specifies that the section is open or closed

AddXXXXGadget(prop1, section, "Description", ...optional args for the gadget type... )

AddXXXXGadget stands for AddStringGadget, AddButtonGadget, AddComboBoxGadget etc.

Because the Gadgets within the PropertyGridGadget are PB Gadgets, you can work with them as usual
and check the events etc.

You have to call CheckPropertyGridSectionClick(PropertyGridGadget,EventGadget(),EventType())
for #PB_Event_Gadget in your event loop (for all your PropertyGrid's!) if the event was not for
your own gadgets.


Image

Code:
;
; Simple PropertyGrid
;
; by Danilo, May 2012, PureBasic 4.60
;
#PropertyGrid_SectionFont     = "Arial"

CompilerSelect #PB_Compiler_OS
    CompilerCase                              #PB_OS_Windows
        #PropertyGrid_DefaultItemHeight = 20
        #PropertyGrid_SectionFontSize   = 10
    CompilerCase                              #PB_OS_Linux
        #PropertyGrid_DefaultItemHeight = 22
        #PropertyGrid_SectionFontSize   = 10
    CompilerCase                              #PB_OS_MacOS
        #PropertyGrid_DefaultItemHeight = 25
        #PropertyGrid_SectionFontSize   = 14
    CompilerDefault                           ; future
        #PropertyGrid_DefaultItemHeight = 20
        #PropertyGrid_SectionFontSize   = 12
CompilerEndSelect

Structure PropertyGridGadgetSubItem
    DescriptionGadget.i
    ItemGadget.i
EndStructure

Structure PropertyGridItem
    SectionDescriptionGadget.i
    SectionButtonGadget.i
    IsSection.i
    Opened.i
    List SubItems.PropertyGridGadgetSubItem()
EndStructure

Structure PropertyGridData
    ItemHeight.i
    Font.i
    backColor.q
    frontColor.q
    List Items.PropertyGridItem()
EndStructure

Procedure __GetPropertyGridImage(open.i)
    Static openImage.i, closeImage.i
   
    If Not openImage
        openImage = CreateImage(#PB_Any,11,11,24)
        If openImage And StartDrawing( ImageOutput(openImage) )
            Box(0,0,11,11,RGB($FF,$FF,$FF))
            DrawingMode(#PB_2DDrawing_Outlined)
            Box(0,0,11,11,RGB($00,$00,$00))
            LineXY(2,5,8,5,RGB($00,$00,$00))
            StopDrawing()
        EndIf
    EndIf
    If Not closeImage
        closeImage = CreateImage(#PB_Any,11,11,24)
        If closeImage And StartDrawing( ImageOutput(closeImage) )
            Box(0,0,11,11,RGB($FF,$FF,$FF))
            DrawingMode(#PB_2DDrawing_Outlined)
            Box(0,0,11,11,RGB($00,$00,$00))
            LineXY(2,5,8,5,RGB($00,$00,$00))
            LineXY(5,2,5,8,RGB($00,$00,$00))
            StopDrawing()
        EndIf
    EndIf

   
    If open
        ProcedureReturn openImage
    Else
        ProcedureReturn closeImage
    EndIf
EndProcedure

Procedure UpdatePropertyGrid(PropertyGridGadget)
    *memory.PropertyGridData = GetGadgetData(PropertyGridGadget)
    If *memory
        i = 0
        height = *memory\ItemHeight
        width  = GadgetWidth(PropertyGridGadget)
        ForEach *memory\Items()
            If *memory\Items()\IsSection
                ResizeGadget( *memory\Items()\SectionDescriptionGadget,20,i,width-20,height-1)
                ResizeGadget( *memory\Items()\SectionButtonGadget     , 4,i+height*0.5-6,11,11)
            Else
                ResizeGadget( *memory\Items()\SectionDescriptionGadget,20,i,width*0.5-40,height-1)
                ResizeGadget( *memory\Items()\SectionButtonGadget     ,width*0.5-19,i,width*0.5-4,height-1)
            EndIf
            i + height
            If *memory\Items()\Opened
                ForEach *memory\Items()\SubItems()
                    ResizeGadget( *memory\Items()\SubItems()\DescriptionGadget,20,i,width*0.5-40,height-1)
                    ResizeGadget( *memory\Items()\SubItems()\ItemGadget       ,width*0.5-19,i,width*0.5-4,height-1)
                    i + height
                Next
            EndIf
        Next
        If GetGadgetAttribute(PropertyGridGadget,#PB_ScrollArea_InnerHeight) <> i
            SetGadgetAttribute(PropertyGridGadget,#PB_ScrollArea_InnerHeight,i)
        EndIf
        If GetGadgetAttribute(PropertyGridGadget,#PB_ScrollArea_InnerWidth) <> width-20
            SetGadgetAttribute(PropertyGridGadget,#PB_ScrollArea_InnerWidth,width-20)
        EndIf
       
    EndIf
EndProcedure


Procedure __SetSection(PropertyGridGadget,section)
    *memory.PropertyGridData = GetGadgetData(PropertyGridGadget)
    If *memory
        If section = 0
            LastElement( *memory\Items() )
            OpenGadgetList(PropertyGridGadget)
            ProcedureReturn #True
        EndIf
        ForEach *memory\Items()
            If *memory\Items()\SectionButtonGadget = section
                OpenGadgetList(PropertyGridGadget)
                ProcedureReturn #True
            EndIf
        Next
    EndIf
EndProcedure

Procedure __AddSectionItem(PropertyGridGadget,section,Description.s,Gadget.i)
    *memory.PropertyGridData = GetGadgetData(PropertyGridGadget)
    If *memory

        descGadget = StringGadget(#PB_Any,0,0,0,0,Description,#PB_String_ReadOnly)
        ;descGadget = TextGadget(#PB_Any,0,0,0,0,Description);,#PB_Text_Border)
        ;DisableGadget( descGadget, 1 )
   
        If section = 0
            If AddElement( *memory\Items() )
                *memory\Items()\IsSection = 0
                *memory\Items()\SectionButtonGadget      = Gadget
                *memory\Items()\SectionDescriptionGadget = descGadget
                CloseGadgetList()
                UpdatePropertyGrid(PropertyGridGadget)
                ProcedureReturn #True
            EndIf
        Else
            LastElement( *memory\Items()\SubItems() )
            If AddElement( *memory\Items()\SubItems() )
                *memory\Items()\SubItems()\DescriptionGadget = descGadget
                *memory\Items()\SubItems()\ItemGadget        = Gadget
                CloseGadgetList()
                If *memory\Items()\Opened
                    UpdatePropertyGrid(PropertyGridGadget)
                Else
                    HideGadget(*memory\Items()\SubItems()\DescriptionGadget,1)
                    HideGadget(*memory\Items()\SubItems()\ItemGadget       ,1)
                EndIf
                ProcedureReturn #True
            EndIf
        EndIf
    EndIf
    FreeGadget(Gadget)
EndProcedure

Procedure PropertyGridGadget(gadgetNr,x,y,width,height,backColor.q=-1,frontColor.q=-1,flags=#PB_ScrollArea_Single)
    gadget = ScrollAreaGadget(gadgetNr,x,y,width,height,width-20,1,#PropertyGrid_DefaultItemHeight,flags)
    If gadget
        If gadgetNr = #PB_Any : gadgetNr = gadget : EndIf
        If backColor <> -1
            SetGadgetColor(gadgetNr,#PB_Gadget_BackColor,backColor)
        EndIf
        If frontColor <> -1
            SetGadgetColor(gadgetNr,#PB_Gadget_FrontColor,frontColor)
        EndIf
        *memory.PropertyGridData = AllocateMemory( SizeOf(PropertyGridData) )
        If Not *memory
            FreeGadget(gadgetNr)
            ProcedureReturn 0
        EndIf
        InitializeStructure(*memory,PropertyGridData)
        *memory\ItemHeight = #PropertyGrid_DefaultItemHeight
        *memory\Font       = LoadFont(#PB_Any,#PropertyGrid_SectionFont,#PropertyGrid_SectionFontSize,#PB_Font_Bold)
        *memory\backColor  = backColor
        *memory\frontColor = frontColor
        SetGadgetData(gadgetNr,*memory)
        CloseGadgetList()
    EndIf
    ProcedureReturn gadgetNr
EndProcedure

Procedure AddSection(PropertyGridGadget,sectionName.s,open.i=1)
    *memory.PropertyGridData = GetGadgetData(PropertyGridGadget)
    If *memory
        LastElement( *memory\Items() )
        If AddElement( *memory\Items() )
            OpenGadgetList(PropertyGridGadget)
            width  = GadgetWidth(PropertyGridGadget)
            height = *memory\ItemHeight
            gadget = TextGadget(#PB_Any,20,0,width-20,height,sectionName)
            *memory\Items()\SectionDescriptionGadget = gadget
            *memory\Items()\SectionButtonGadget      = ImageGadget(#PB_Any,0,0,0,0,ImageID(__GetPropertyGridImage(open)))
            *memory\Items()\Opened    = open
            *memory\Items()\IsSection = 1
            SetGadgetFont(gadget,FontID(*memory\Font))
            If *memory\backColor <> -1
                SetGadgetColor(gadget,#PB_Gadget_BackColor,*memory\backColor)
            EndIf
            If *memory\frontColor <> -1
                SetGadgetColor(gadget,#PB_Gadget_FrontColor,*memory\frontColor)
            EndIf
            CloseGadgetList()
            UpdatePropertyGrid(PropertyGridGadget)
            ProcedureReturn *memory\Items()\SectionButtonGadget
        EndIf
    EndIf
EndProcedure

Procedure CheckPropertyGridSectionClick(PropertyGridGadget,EventGadget,EventType)
    *memory.PropertyGridData = GetGadgetData(PropertyGridGadget)
    If *memory
        ForEach *memory\Items()
            If EventGadget = *memory\Items()\SectionButtonGadget And EventType = #PB_EventType_LeftClick
                *memory\Items()\Opened ! 1
                open = *memory\Items()\Opened
                SetGadgetState(*memory\Items()\SectionButtonGadget,ImageID(__GetPropertyGridImage(open)))
                ForEach *memory\Items()\SubItems()
                    HideGadget( *memory\Items()\SubItems()\DescriptionGadget , 1-open )
                    HideGadget( *memory\Items()\SubItems()\ItemGadget        , 1-open )
                Next
                UpdatePropertyGrid(PropertyGridGadget)
                Break
            EndIf
        Next
        UpdatePropertyGrid(PropertyGridGadget)
    EndIf
EndProcedure

;---[ PropertyGrid Gadgets ]---

Procedure AddStringGadget(PropertyGridGadget,section,Description.s,Content.s,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = StringGadget(#PB_Any,0,0,0,0,Content,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddCheckBoxGadget(PropertyGridGadget,section,Description.s,Text.s,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = CheckBoxGadget(#PB_Any,0,0,0,0,Text,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddButtonGadget(PropertyGridGadget,section,Description.s,Text.s,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = ButtonGadget(#PB_Any,0,0,0,0,Text,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddComboBoxGadget(PropertyGridGadget,section,Description.s,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = ComboBoxGadget(#PB_Any,0,0,0,0,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddProgressBarGadget(PropertyGridGadget,section,Description.s,Minimum,Maximum,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = ProgressBarGadget(#PB_Any,0,0,0,0,Minimum,Maximum,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddSpinGadget(PropertyGridGadget,section,Description.s,Minimum,Maximum,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = SpinGadget(#PB_Any,0,0,0,0,Minimum,Maximum,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddTrackBarGadget(PropertyGridGadget,section,Description.s,Minimum,Maximum,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = TrackBarGadget(#PB_Any,0,0,0,0,Minimum,Maximum,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure


Procedure AddSplitterGadget(PropertyGridGadget,section,Description.s,Gadget1,Gadget2,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = SplitterGadget(#PB_Any,0,0,0,0,Gadget1,Gadget2,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddIPAddressGadget(PropertyGridGadget,section,Description.s)
    If __SetSection(PropertyGridGadget,section)
        gadget = IPAddressGadget(#PB_Any,0,0,120,#PropertyGrid_DefaultItemHeight)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddShortcutGadget(PropertyGridGadget,section,Description.s,Shortcut)
    If __SetSection(PropertyGridGadget,section)
        gadget = ShortcutGadget(#PB_Any,0,0,0,0,Shortcut)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddDateGadget(PropertyGridGadget,section,Description.s,Mask$="",Date=0,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = DateGadget(#PB_Any,0,0,0,0,Mask$,Date,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

Procedure AddHyperLinkGadget(PropertyGridGadget,section,Description.s,Text$,Color,flags=0)
    If __SetSection(PropertyGridGadget,section)
        gadget = HyperLinkGadget(#PB_Any,0,0,0,0,Text$,Color,flags)
        If __AddSectionItem(PropertyGridGadget,section,Description,gadget)
            ProcedureReturn gadget
        EndIf
    EndIf
EndProcedure

;---------------------------------------------------------------------

Procedure AddComboBox_FalseTrue(PropertyGridGadget,section,Description.s,FalseTrue.i)
    combo = AddComboBoxGadget(PropertyGridGadget,section,Description)
    AddGadgetItem(combo,-1,"False")
    AddGadgetItem(combo,-1,"True")
    SetGadgetState(combo,FalseTrue)
    ProcedureReturn combo
EndProcedure

OpenWindow(0,0,0,800,600,"PropertyGrid",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)

prop = PropertyGridGadget(#PB_Any,10,10,300,580);,RGB($80,$80,$80),RGB($00,$00,$00))

section1 = AddSection(prop,"Section 1")

    string1  = AddStringGadget(prop,section1,"String","Item 1")
    string2  = AddStringGadget(prop,section1,"Number","123456",#PB_String_Numeric)
   
    spin1    = AddSpinGadget  (prop,section1,"SpinGadget",1,100,#PB_Spin_Numeric)
    SetGadgetText(spin1,"1")
   
    split = AddSplitterGadget(prop,section1,"Splitter",ButtonGadget(#PB_Any,0,0,50,0,"1"),ButtonGadget(#PB_Any,0,0,50,0,"2"),#PB_Splitter_Vertical)
    SetGadgetAttribute(split,#PB_Splitter_FirstMinimumSize,50)
    SetGadgetAttribute(split,#PB_Splitter_SecondMinimumSize,50)

    AddTrackBarGadget(prop,section1,"Trackbar",1,100)

section2 = AddSection(prop,"Section 2")

    combo1 = AddComboBoxGadget(prop,section2,"Combobox 1")
    For i = 1 To 10 : AddGadgetItem(combo1,-1,"Item "+Str(i)) : Next
   
    check1 = AddCheckBoxGadget(prop,section2,"Checkbox 1","Check me!")
    btn1   = AddButtonGadget  (prop,section2,"Choose Directory","...")

section3 = AddSection(prop,"Section 3")

    progress = AddProgressBarGadget(prop,section3,"Progress",0,100)
    SetGadgetState(progress,40)

    AddShortcutGadget(prop,section3,"Shortcut",0)

    AddDateGadget(prop,section3,"Date")
   
    AddHyperLinkGadget(prop,section3,"Hyperlink","Hyper Hyper!",RGB($00,$00,$FF))

    ip = AddIPAddressGadget(prop,section3,"IP Address")
    SetGadgetState(ip, MakeIPAddress(127, 0, 0, 1))

For i = 4 To 20
    sec = AddSection(prop,"Section "+Str(i),0)
    For j = 1 To 10
        AddStringGadget(prop,sec,"Description "+Str(j),"Item "+Str(j))
    Next j
Next i



prop2 = PropertyGridGadget(#PB_Any,330,10,450,280,RGB($40,$40,$40),RGB($FF,$FF,$FF))
For i = 1 To 20
    sec = AddSection(prop2,"Section "+Str(i),0)
    For j = 1 To 10
        AddStringGadget(prop2,sec,"Section "+Str(i)+", Field "+Str(j),"Item "+Str(j))
    Next j
Next i

prop3 = PropertyGridGadget(#PB_Any,330,300,300,280,-1,-1,#PB_ScrollArea_Flat)
AddComboBox_FalseTrue(prop3,0,"AllowDrop"    ,#False)
AddComboBox_FalseTrue(prop3,0,"Enabled"      ,#True)
AddComboBox_FalseTrue(prop3,0,"FullRowSelect",#False)
AddComboBox_FalseTrue(prop3,0,"HideSelection",#True)
AddComboBox_FalseTrue(prop3,0,"HotTracking"  ,#False)
spinImgIdx    = AddSpinGadget  (prop3,0,"ImageIndex",1,100,#PB_Spin_Numeric) : SetGadgetText(spinImgIdx,"1")
secImageSize  = AddSection(prop3,"ImageSize",0)
spinImgWidth  = AddSpinGadget  (prop3,secImageSize,"Width ",1,100,#PB_Spin_Numeric) : SetGadgetText(spinImgWidth ,"32")
spinImgHeight = AddSpinGadget  (prop3,secImageSize,"Height",1,100,#PB_Spin_Numeric) : SetGadgetText(spinImgHeight,"32")


While WindowEvent():Wend
HideWindow(0,0)

Repeat
    Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
            Break
        Case #PB_Event_Gadget
            EventGadget = EventGadget()
            EventType   = EventType()
            Select EventGadget
                Case btn1
                    MessageRequester("INFO","Button pressed")
                Default
                    ; check for PropertyGrid Events (section opened/closed)
                    CheckPropertyGridSectionClick(prop ,EventGadget,EventType)
                    CheckPropertyGridSectionClick(prop2,EventGadget,EventType)
                    CheckPropertyGridSectionClick(prop3,EventGadget,EventType)
            EndSelect
    EndSelect
ForEver


Last edited by Danilo on Tue May 22, 2012 6:45 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 9:34 am 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1009
Location: Amphibios 9
@Danilo: Image

Perhaps i have found an interesting MFC component (outdated but with source and free for personal and commercial use)

http://www.visualhint.com/propertygridmfc

Greetings ... Kiffi

_________________
Can't decide if i need a hug, an XXL coffee, 6 shots of vodka or 2 weeks of sleep.


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 9:47 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Mar 06, 2006 3:53 pm
Posts: 562
Location: Austria
Tested on:
Win XP 32bit, PB 4.61b4
Image


Linux Mint 10 32 bit, PB 4.60
Image



OSX seems a little buggy (fields are all empty), OSX Snow Leo, PB 4.61b1:
Image

Nevertheless: Thanks for sharing, great work!

_________________
cheers,

bembulak


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 5:44 pm 
Offline
User
User

Joined: Sat Mar 06, 2010 2:55 pm
Posts: 85
Wow Danilo!

Clean and good code! I learned a lot from it, like storing a pointer of a structure in SetGadgetData!
Never knew that was possible like this.

Thanks a lot for this!

Ps. Now we only need a datagrid and we are all set! :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 6:34 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2917
Location: Planet Earth
bembulak wrote:
OSX seems a little buggy (fields are all empty), OSX Snow Leo, PB 4.61b1:
Image

Thanks for testing! Can you please try again and change #PropertyGrid_DefaultItemHeight = 20
at the very beginning to 25 or 30 on Macintosh OSX?
Maybe the texts are not drawn because the item height is too small. Otherwise I don't know
why it should not work on OSX.

For a different look you can also change the type of the description field in __AddSectionItem():

Replace
Code:
            *memory\Items()\SubItems()\DescriptionGadget = StringGadget(#PB_Any,0,0,0,0,Description,#PB_String_ReadOnly)

with
Code:
            *memory\Items()\SubItems()\DescriptionGadget = TextGadget(#PB_Any,0,0,0,0,Description);,#PB_Text_Border)

(already commented in the code)

The description fields are just TextGadget after the change:
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 6:40 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5754
Location: Berlin - Germany
Image great work, very useful, thx

_________________
PureBasic 5.70 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 9:33 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1628
Location: Germany
I can't reproduce bembulak's MacOS X screenshot with empty cells!
Although increasing the value of #PropertyGrid_DefaultItemHeight
- as proposed by Danilo - would of course improve the display of
the currently partially cut text...

MacOS X 10.6.8 and PB 4.61 Beta 4:
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Mon May 21, 2012 11:41 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1981
Location: Germany
Easy code, cross-plattform, great functionality - simply excellent!

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Tue May 22, 2012 6:51 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2917
Location: Planet Earth
Updated code:
- If you specify 0 as the section in AddXXXXGadget, it is added to the main PropertyGrid and not in a section. See first screenshot, 3rd PropertyGridGadget().
- Added CompilerSelect for Win/Mac/Linux section and font size. (What is a good SectionFontSize and DefaultItemHeight for OSX?)


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Tue May 22, 2012 11:20 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4461
Location: Lyon - France
Simple is not the first adjective beginning by "S" who come in my head when i see your gread code.
Better is Splendid :shock:
Thanks a lot for sharing this jewel 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Wed May 23, 2012 6:58 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
Great code Danilo!

Also -- I did not even know DateGadget() or ShortcutGadget() existed :shock: were those recently added? (hurries away to check PB history)

EDIT... apparently they have been around for years :lol:


Last edited by kenmo on Wed May 23, 2012 11:56 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Wed May 23, 2012 11:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 21, 2011 9:11 am
Posts: 606
Location: France
Whaouuuu .....great work Danilo and thanks for sharing:)

_________________

➽ Windows 10 - PB 5.62 & PB 5.70 LTS

Sorry for my bad english and the Dunning–Kruger effect.


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Thu May 24, 2012 10:56 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Apr 07, 2011 1:14 pm
Posts: 243
Location: 3 arks
yahoutch !
Excellent Danilo

Thank you a lot !


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Thu May 24, 2012 11:00 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jun 26, 2003 2:09 am
Posts: 744
Location: Spain (Galicia)
PropertyGadget is a great aportation, probably the best since CanvasGadget.
Kudos Danilo!
Fred: My vote to make it native!

( I'm afraid I'll MUST try to rewrite my 20000 lines music project using this **** PG :x )


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple PropertyGrid
PostPosted: Fri May 25, 2012 12:27 am 
Offline
Addict
Addict
User avatar

Joined: Tue Nov 09, 2010 10:15 pm
Posts: 1521
mevedia.de wrote:
A bit like my old Solution 'PropertiesBoxGadget' :)

...except with source! :D


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 87 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye