PureRESIZE library : gadget automatic resizing and more

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

univeda
User
User
Posts: 22
Joined: Wed May 13, 2009 12:40 am
Location: Germany

Post by univeda »

Thank you both for replying.

Ok, then...

I'm trying to implemt a selfmade-solution. My current solution is rather slow. Especially when using a ListIconGadget.

But first i'm trying to use another solutions which i found in this forum (it's from ChaOsKid). It seems to be very fast.

Michael
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

New version compiled with PB4.40 BETA 1 : http://freenet-homepage.de/gnozal/PureRESIZE_440.zip
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PureRESIZE library : gadget automatic resizing and more

Post by c4s »

Hi Gnozal, I think I found a bug.

Look at this code:

Code: Select all

If OpenWindow(0, #PB_Ignore, #PB_Ignore, 100, 100, "PureRESIZE Test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
	SpinGadget(1, 10, 10, 80, 30, 1, 10, #PB_Spin_Numeric)
	PureRESIZE_SetGadgetResize(1, 1, 1, 1, 0)

	Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
When I lock the SpinGadget at the right side it will get a bit smaller after resizing the window.
I hope you can fix this.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureRESIZE library : gadget automatic resizing and more

Post by gnozal »

c4s wrote:When I lock the SpinGadget at the right side it will get a bit smaller after resizing the window.
I hope you can fix this.
Confirmed.
It's because GetWindowRect_() doesn't report the full width for GadgetID(SpinGadget).
Easy workaround for now : call PureRESIZE_ResizeWindowNow() once before the event-loop and it should work as expected.

Code: Select all

If OpenWindow(0, #PB_Ignore, #PB_Ignore, 100, 100, "PureRESIZE Test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
  SpinGadget(1, 10, 10, 80, 30, 1, 10, #PB_Spin_Numeric)
  PureRESIZE_SetGadgetResize(1, 1, 1, 1, 0)
  
  PureRESIZE_ResizeWindowNow(0)
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PureRESIZE library : gadget automatic resizing and more

Post by c4s »

Ok, normally I unhide the window and then I already have the same as PureRESIZE_ResizeWindowNow().
So do you think I should make the SpinGadget a bit wider?

And by the way: I tried to use the following code to find out how much I should widen the SpinGadget but it says 80 instead of 65.

Code: Select all

 GetWindowRect_(GadgetID(1), @r11.RECT)
 GetWindowRect_(GetWindow_(GadgetID(1), #GW_HWNDNEXT), @r12.RECT)
 Debug r12\right - r11\left
I'm confused..
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureRESIZE library : gadget automatic resizing and more

Post by gnozal »

This should work :

Code: Select all

If OpenWindow(0, #PB_Ignore, #PB_Ignore, 100, 100, "PureRESIZE Test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
  SpinGadget(1, 10, 10, 80, 30, 1, 10, #PB_Spin_Numeric)
  GetWindowRect_(GetWindow_(GadgetID(1), #GW_HWNDNEXT), @r12.RECT)
  ResizeGadget(1, 10, 10, 80 + r12\right - r12\left, 30)
  PureRESIZE_SetGadgetResize(1, 1, 1, 1, 0)
  ;
  PureRESIZE_ResizeWindowNow(0)
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
EDIT: I have updated PureRESIZE for PB4.40. Could you try it ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PureRESIZE library : gadget automatic resizing and more

Post by c4s »

Looks good - thank you Gnozal!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
quasiperfect
Enthusiast
Enthusiast
Posts: 157
Joined: Tue Feb 13, 2007 6:16 pm
Location: Romania
Contact:

Re: PureRESIZE library : gadget automatic resizing and more

Post by quasiperfect »

@gnozal in 4.4 beta 5 windows 7 x64 i get a polink error corrupt library pureresize_lib_6.lib
Registered user of PureBasic
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: PureRESIZE library : gadget automatic resizing and more

Post by srod »

You cannot use a 32-bit user-lib with a 64-bit exe.
I may look like a mule, but I'm not a complete ass.
User avatar
Magus1011
New User
New User
Posts: 7
Joined: Sat Mar 11, 2006 12:51 am
Location: Winnipeg, Manitoba, Canada

PureRESIZE library : newby question

Post by Magus1011 »

I have PureBasic 4.41, jaPBe 3.9.12.817 and downloaded http://freenet-homepage.de/gnozal/PureRESIZE_440.zip and installed the executable. I was hoping this would help me keep a text gadget in the center of the window while the user resizes the window. There is no mention of any "PureRESIZE_" functions in this file at all. :?: I cannot find any file on this in my jaPBe\help folder either. :?: Can I please get some help with some simple code that I can use to accomplish my goal. :?

The Include file I got (ResizeGadgets.pbi) starts out:
;info: RS_ResizeGadgets (Automatically Resize PureBasic Gadgets)
;
; To use:
; - Include this source file.
; - Call RS_Register ONCE for EACH Gadget to be resized, specifying side locks.
; - Call RS_Resize in the event loop, specifying Event ID and Event Window ID.
;
What are "side locks" and what do they do? Could you please illustrate RS_Unregister() and most importantly RS_Resize(). I don't understand what you mean by the Event ID, where do you get it from? A small working program where all I have to do is set the XIncludeFile line would be very nice :D and probably very informative. :shock:
Last edited by Magus1011 on Mon Mar 01, 2010 3:44 pm, edited 2 times in total.
--
Regards,
Magus.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: PureRESIZE library : gadget automatic resizing and more

Post by srod »

Is there no CHM help manual included? Check your PB installation \Help folder. You will probably also find some demo programs installed somewhere in the PB installation folder.

There is some help on the appropriate webpage : http://freenet-homepage.de/gnozal/PureRESIZE_.htm
I may look like a mule, but I'm not a complete ass.
User avatar
Magus1011
New User
New User
Posts: 7
Joined: Sat Mar 11, 2006 12:51 am
Location: Winnipeg, Manitoba, Canada

RE:PureRESIZE library : newby question

Post by Magus1011 »

srod wrote:Is there no CHM help manual included? Check your PB installation \Help folder. You will probably also find some demo programs installed somewhere in the PB installation folder.

There is some help on the appropriate webpage : http://freenet-homepage.de/gnozal/PureRESIZE_.htm
It was a permissions problem on Windows 7, I think. After installing as administrator I now have a PureRESIZE.chm where I didn't have one before and the same with the PureRESIZE in PureBasic\PureLibraries\UserLibraries.

Thanks for the reply. :lol: Expect more questions as I figure this out.
--
Regards,
Magus.
User avatar
Magus1011
New User
New User
Posts: 7
Joined: Sat Mar 11, 2006 12:51 am
Location: Winnipeg, Manitoba, Canada

PureRESIZE library : Another Newby question

Post by Magus1011 »

I want the TextGadget to start in the center of the window and stay there while the user resizes the window. This is the code I have so far:

Code: Select all

;
Flags = #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget
Flags = Flags|#PB_Window_TitleBar
#TextItem = 1
Text$ = "Hello, World"
;
OpenWindow(1,100,100,200,180,"Test1",Flags)
TextGadget(#TextItem, 0, 0, 100, 15, Text$, #PB_Text_Center|#PB_Text_Border)
PureRESIZE_CenterGadget(#TextItem, 1, 1)
; 
exit = #False 
While exit = #False 
  Event = WaitWindowEvent() 
  Select Event 
    Case #PB_Event_CloseWindow 
      exit = #True 
    Case #PB_Event_Gadget
      GadgetNumber = EventGadget()
  EndSelect 
Wend
End
How do I fix this so it does what I want :?:
--
Regards,
Magus.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureRESIZE library : gadget automatic resizing and more

Post by gnozal »

PureRESIZE.chm -> PureRESIZE_CenterGadget() topic wrote:Syntax

PureRESIZE_CenterGadget(GadgetNumber.l, Horizontal.l, Vertical.l)

Description

Enables automatic centering for a gadget.

Parameters :

- GadgetNumber : valid Purebasic gadget number ; it may also be a valid Windows control handle, this allows to use the library with 'API gadgets' created with CreateWindowEx_().
- Horizontal : enables horizontal centering
- Vertical : enables vertical centering

Note :
This function must be called after PureRESIZE_SetGadgetResize().

Code: Select all

Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Button_0
EndEnumeration
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 452, 199, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    ButtonGadget(#Button_0, 81, 327, 238, 48, "Gadget_0")
    PureRESIZE_SetGadgetResize(#Button_0, 0, 0, 0, 1)
    PureRESIZE_CenterGadget(#Button_0, 1, 0)
  EndIf
EndProcedure

OpenWindow_Window_0()

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Magus1011
New User
New User
Posts: 7
Joined: Sat Mar 11, 2006 12:51 am
Location: Winnipeg, Manitoba, Canada

Re: PureRESIZE library : Another newby question

Post by Magus1011 »

Thanks very much Gnozal. :D

That example proved I had permission problems and not a bad download. I have to reinstall jaPBe after my disk crash since it depends on the Windows Registry and the %PureBasic%\Help and %PureBasic%\PureLibraries\UserLibraries which were on the disk that crashed. Being a newby I didn't realize that. I had it on another disk where I keep programs that don't use the Registry. Yes, it was on the %PATH% :)

Again, thanks for the help :!:
--
Regards,
Magus.
Post Reply