Page 6 of 11
Posted: Thu Jan 17, 2008 9:03 am
by gnozal
tinman wrote:gnozal wrote:How should the buttons move when the window is resized ?
Like the first example, but the size of both gadgets increase as well as being anchored to the left and right edge. Here is some code that shows the effect I would like to achieve: ...
Ok, I see.
Some kind of proportional resizing.
Posted: Thu Jan 17, 2008 9:54 am
by tinman
gnozal wrote:Ok, I see. Some kind of proportional resizing.
Yes, but if you won't add it then it's no problem. Just a request :)
Posted: Thu Jan 17, 2008 6:15 pm
by gnozal
Update (all versions)
Changes :
- new function PureRESIZE_SetGadgetProportionalResize().
This feature is hard to explain ; run the code example in the manual.
Posted: Thu Jan 17, 2008 10:37 pm
by tinman
Woohoo, gnozal you rock! :)
Thank you so much.
Posted: Fri Jan 18, 2008 12:50 am
by Xombie
gnozal,
That was a great addition to your library! One thing I noticed is that (for example) if I have a listicon and I enable resize on top/left/bottom/right and turn on vertical proportional resize, the top does not stay locked.
It seems to me that if all (top/right/bottom/left) are locked and vertical prop. is turned on that only the height of the listicon should change (in proportion to the height change of the window) and not the Y position.
Is this a small bug or am I misinterpreting how it works?
Thanks again for this!
Posted: Fri Jan 18, 2008 11:03 am
by gnozal
Xombie wrote:It seems to me that if all (top/right/bottom/left) are locked and vertical prop. is turned on that only the height of the listicon should change (in proportion to the height change of the window) and not the Y position.
When enabling proportional resize the 'lock' behaviour changes. The proportional feature is designed to resize multiple gadgets on the same line / column.
It's very hard to explain. I use PureFORM to simulate the resizing behaviour : build your form, set the resizing options [Extra tab], hit F5 [Preview mode on], try resizing, hit F5 [Preview mode off], change resize settings, hit F5 [Preview mode on], try resizing, etc...
For your listicon, lock TOP/LEFT only.
Try this code : the 2 listicons resize vertically proportionally to the window height.
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#ListIcon_0
#ListIcon_1
EndEnumeration
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 293, 99, 392, 430, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
ListIconGadget(#ListIcon_0, 5, 5, 190, 235, "Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
ListIconGadget(#ListIcon_1, 5, 245, 190, 180, "Gadget_1", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
PureRESIZE_SetGadgetResize(#ListIcon_0, 1, 1, 0, 0)
PureRESIZE_SetGadgetProportionalResize(#ListIcon_0, 0, 1)
PureRESIZE_SetGadgetResize(#ListIcon_1, 1, 1, 0, 0)
PureRESIZE_SetGadgetProportionalResize(#ListIcon_1, 0, 1)
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
CloseWindow(#Window_0)
Break
EndSelect
Forever
Posted: Fri Jan 18, 2008 4:49 pm
by Xombie
gnozal,
I put together an example in PureForm for your reference. There are 3 dividing lines and a listicon in a container on the form. If you resize the height of the window you'll (hopefully) see that the listicon's Y position changes in regard to the second dividing bar.
I also tried without the container and got the same behavior.
Code: Select all
;{- Enumerations / DataSections
;{ Windows
Enumeration
#WindowMain
EndEnumeration
;}
;{ Status bars
Enumeration
#StatusBar_WindowMain
EndEnumeration
;}
;{ Gadgets
Enumeration
#ContainTest
#DivideTest01
#DivideTest02
#DivideTest03
#ListTestMain
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;}
Procedure OpenWindow_WindowMain()
If OpenWindow(#WindowMain, #PB_Ignore, #PB_Ignore, 900, 700, "Test", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_MaximizeGadget)
If CreateStatusBar(#StatusBar_WindowMain, WindowID(#WindowMain))
EndIf
If CreateGadgetList(WindowID(#WindowMain))
ContainerGadget(#ContainTest, 102, 0, 798, 680, #PB_Container_Raised) ;>
TextGadget(#DivideTest01, 1, 25, 790, 5, " ", #PB_Text_Border)
TextGadget(#DivideTest02, 1, 165, 790, 5, " ", #PB_Text_Border)
TextGadget(#DivideTest03, 1, 625, 790, 5, " ", #PB_Text_Border)
ListIconGadget(#ListTestMain, 1, 175, 790, 445, "", 0, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
CloseGadgetList() ;<
; Gadget Resizing
PureRESIZE_SetGadgetResize(#ContainTest, 1, 1, 1, 1)
PureRESIZE_SetGadgetResize(#DivideTest01, 1, 1, 1, 0, #ContainTest)
PureRESIZE_SetGadgetResize(#DivideTest02, 1, 1, 1, 0, #ContainTest)
PureRESIZE_SetGadgetResize(#DivideTest03, 1, 0, 1, 1, #ContainTest)
PureRESIZE_SetGadgetProportionalResize(#DivideTest03, 0, 1)
PureRESIZE_SetGadgetResize(#ListTestMain, 1, 1, 0, 0, #ContainTest)
PureRESIZE_SetGadgetProportionalResize(#ListTestMain, 0, 1)
; Window Minimum Size
PureRESIZE_SetWindowMinimumSize(#WindowMain, 900, 700)
EndIf
EndIf
EndProcedure
OpenWindow_WindowMain()
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #WindowMain
CloseWindow(#WindowMain)
Break
EndIf
EndSelect
ForEver
;
;}
Posted: Sat Jan 19, 2008 9:32 am
by gnozal
Xombie wrote:gnozal,
I put together an example in PureForm for your reference. There are 3 dividing lines and a listicon in a container on the form. If you resize the height of the window you'll (hopefully) see that the listicon's Y position changes in regard to the second dividing bar.
Ok, I see what you mean.
The proportional feature is designed to resize
all gadgets on the same line / column like in this project [Edit -> Load project from clipboard] :
Code: Select all
;{[PureFORM Project]
;PureFORM_Project_Begin
;Project¶!!XombieProject
;Window¶1¶#WindowMain¶13565952¶#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_MaximizeGadget¶Test¶345¶63¶900¶708¶0¶0¶0¶0¶0¶0¶0¶-1¶0¶¶¶
;ContainerGadget¶1¶#ContainTest¶1¶-1¶-1¶0¶0¶5¶0¶2¶#PB_Container_Raised¶¶¶-1¶0¶¶¶0¶0¶1¶0¶0¶102¶0¶798¶680¶1¶1¶1¶1¶1¶0·0·0¶0¶-1¶-1¶-1¶-1¶¶0¶¶0¶0
;TextGadget¶2¶#DivideTest01¶1¶1¶5¶0¶0¶26¶0¶131072¶#PB_Text_Border¶ ¶¶-1¶0¶¶¶0¶0¶0¶0¶0¶1¶25¶790¶5¶1¶1¶1¶0¶0¶1·0·1¶0¶-1¶-16777216¶-1¶-1¶¶0¶¶0¶0
;TextGadget¶3¶#DivideTest02¶1¶1¶5¶0¶0¶26¶0¶131072¶#PB_Text_Border¶ ¶¶-1¶0¶¶¶0¶0¶0¶0¶0¶1¶165¶790¶5¶1¶1¶1¶0¶0¶1·0·1¶0¶-1¶-16777216¶-1¶-1¶¶0¶¶0¶0
;TextGadget¶4¶#DivideTest03¶1¶1¶5¶0¶0¶26¶0¶131072¶#PB_Text_Border¶ ¶¶-1¶0¶¶¶0¶0¶0¶0¶0¶1¶625¶790¶5¶1¶1¶1¶0¶0¶1·0·1¶0¶-1¶-16777216¶-1¶-1¶¶0¶¶0¶0
;ListIconGadget¶5¶#ListTestMain¶1¶1¶5¶0¶0¶15¶0¶1073807368¶#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect¶¶¶-1¶0¶0¶¶0¶0¶0¶0¶0¶1¶175¶790¶445¶1¶1¶1¶0¶0¶1·0·1¶0¶-1¶-1¶-1¶-1¶¶0¶¶0¶0
;PureFORM_Project_End
;}
I never thought about (fixed height) separators ...
I will try to add some extra parameters to allow proportional movement without changing width / height.
Posted: Sat Jan 19, 2008 11:08 am
by gnozal
Update (all versions)
Changes :
- added extra parameters to PureRESIZE_SetGadgetProportionalResize() allowing to lock the width / height. Gadget still moves proportionaly to the parent, but the width / height is locked (usefull for separators).
Xombie, try this code with the new library : I hope it's what you expected. I don't think I can do better for now.
Code: Select all
;
; /////////////// EXAMPLE 2
;
Enumeration
#WindowMain
EndEnumeration
Enumeration
#ContainTest
#DivideTest01
#DivideTest02
#DivideTest03
#ListTestMain
EndEnumeration
Procedure OpenWindow_WindowMain()
If OpenWindow(#WindowMain, 345, 63, 820, 708, "PureRESIZE proportional demo 2", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(#WindowMain))
ContainerGadget(#ContainTest, 10, 0, 798, 680, #PB_Container_Raised)
TextGadget(#DivideTest01, 1, 25, 790, 5, " ", #PB_Text_Border)
TextGadget(#DivideTest02, 1, 165, 790, 5, " ", #PB_Text_Border)
TextGadget(#DivideTest03, 1, 625, 790, 5, " ", #PB_Text_Border)
ListIconGadget(#ListTestMain, 1, 175, 790, 445, "", 0, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
CloseGadgetList()
EndIf
EndIf
EndProcedure
OpenWindow_WindowMain()
PureRESIZE_SetGadgetResize(#ContainTest, 1, 1, 1, 1)
PureRESIZE_SetGadgetResize(#DivideTest01, 1, 1, 0, 0, #ContainTest)
PureRESIZE_SetGadgetResize(#DivideTest02, 1, 1, 0, 0, #ContainTest)
PureRESIZE_SetGadgetResize(#DivideTest03, 1, 1, 0, 0, #ContainTest)
PureRESIZE_SetGadgetResize(#ListTestMain, 1, 1, 0, 0, #ContainTest)
; Proportional vertical resize with separators
PureRESIZE_SetGadgetProportionalResize(#DivideTest01, 0, 1, 0, 1)
PureRESIZE_SetGadgetProportionalResize(#DivideTest02, 0, 1, 0, 1)
PureRESIZE_SetGadgetProportionalResize(#DivideTest03, 0, 1, 0, 1)
PureRESIZE_SetGadgetProportionalResize(#ListTestMain, 0, 1)
PureRESIZE_SetWindowMinimumSize(#WindowMain, 820, 400)
PureRESIZE_SetWindowMaximumSize(#WindowMain, 820, 800)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #WindowMain
CloseWindow(#WindowMain)
Break
EndSelect
EndSelect
ForEver
End
Posted: Mon Jan 28, 2008 5:59 pm
by gnozal
Update (all versions)
Changes :
- new function PureRESIZE_CenterGadget(GadgetNumber.l, Horizontal.l, Vertical.l) : enables automatic centering for a gadget.
Please see help file code example.
Posted: Mon Jan 28, 2008 10:10 pm
by storck
Thank you Gnozal!
I love the option to center a gadget.
Where do you find the time for all these updates? Do you have like 25 hour days where you live? 10 days each week? 400 days each year? It must be something... Or is it just hard work?
Best Regards,
Storck
Posted: Fri Feb 01, 2008 12:14 pm
by Zizaco
http://www.purebasic.fr/english/viewtopic.php?t=30902
Is it possible to use the PureRESIZE library with the "Windows" inside a MDIGadget?
The functions PureRESIZE_SetWindowMinimumSize and MaximumSize works for me, but the "PureRESIZE_SetGadgetResize() " don't.
Why? There is any way to get it to work?
Posted: Sat Feb 02, 2008 1:33 pm
by gnozal
Zizaco wrote:http://www.purebasic.fr/english/viewtopic.php?t=30902
Is it possible to use the PureRESIZE library with the "Windows" inside a MDIGadget?
The functions PureRESIZE_SetWindowMinimumSize and MaximumSize works for me, but the "PureRESIZE_SetGadgetResize() " don't.
Why? There is any way to get it to work?
Sorry ...
I didn't think about MDI when I designed the library because I never use MDI.
Please note that MDI gadget items are windows, not gadgets ...
Posted: Sat Apr 12, 2008 10:52 am
by quasiperfect
i think there is a bug in the panel gadget resizing it dosen't work properly
here is a pureform project with the bug in action
http://www.quasiperfect.eu/diverse/qpphp.pbf
Posted: Sat Apr 12, 2008 10:54 am
by gnozal
quasiperfect wrote:i think there is a bug in the panel gadget resizing it dosen't work properly
i can send u a pureform project with the bug in action
Yep, some code would help.