Page 8 of 11

Posted: Sun May 24, 2009 2:48 pm
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

Posted: Mon Aug 17, 2009 4:52 pm
by gnozal
New version compiled with PB4.40 BETA 1 : http://freenet-homepage.de/gnozal/PureRESIZE_440.zip

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Mon Oct 12, 2009 5:39 pm
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.

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Tue Oct 13, 2009 7:48 am
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

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Tue Oct 13, 2009 10:49 am
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..

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Tue Oct 13, 2009 11:03 am
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 ?

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Tue Oct 13, 2009 2:38 pm
by c4s
Looks good - thank you Gnozal!

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Sat Oct 17, 2009 10:42 am
by quasiperfect
@gnozal in 4.4 beta 5 windows 7 x64 i get a polink error corrupt library pureresize_lib_6.lib

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Sat Oct 17, 2009 10:50 am
by srod
You cannot use a 32-bit user-lib with a 64-bit exe.

PureRESIZE library : newby question

Posted: Mon Mar 01, 2010 3:29 pm
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:

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Mon Mar 01, 2010 3:38 pm
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

RE:PureRESIZE library : newby question

Posted: Mon Mar 01, 2010 3:56 pm
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.

PureRESIZE library : Another Newby question

Posted: Mon Mar 01, 2010 5:44 pm
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 :?:

Re: PureRESIZE library : gadget automatic resizing and more

Posted: Tue Mar 02, 2010 8:48 am
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

Re: PureRESIZE library : Another newby question

Posted: Tue Mar 02, 2010 7:42 pm
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 :!: