Restored from previous forum. Originally posted by PB.
I got this tip from Microsoft's Knowledge Base and converted it to PureBasic;
not entirely (eg. fonts), but most of it. Hope it's of use to you! Written
for Windows, but might work with Amiga/Linux.
The original Microsoft tip was here:
http://support.microsoft.com/default.as ... us;Q182070
And here's my version, which, incidentally, will be incorporated into vis2pure's
next release for auto-resizing forms.
Example snipped: See new version below which now supports PanetGadgets.
PB - Registered PureBasic Coder
Edited by - PB on 28 February 2002 19:12:40
Tip: Creating a resolution-independent window
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by MrVainSCL.
Hi Paul
Nice example... Surely vers usefull for some appz coders and esp. for newbies who want to code a boopsi gui Stay cool... bye
PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...
greetz
MrVainSCL! aka Thorsten
Hi Paul
Nice example... Surely vers usefull for some appz coders and esp. for newbies who want to code a boopsi gui Stay cool... bye
PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...
greetz
MrVainSCL! aka Thorsten
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
Hi Paul.
Nice to see someone else who tries a resizeable GUI. MrVain and I tried to.
But there is still a little but very nasty bug in PB since Version 2.50.
Create a Pannelgadget and place some Gadgets in it and try to resize it bigger.
You will see that all Gadgets that will be placed or drawn over the actual original size dont be updated/ drawn again.
Still waiting for a fixed Version from Fred, but till yet, no response.
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
Hi Paul.
Nice to see someone else who tries a resizeable GUI. MrVain and I tried to.
But there is still a little but very nasty bug in PB since Version 2.50.
Create a Pannelgadget and place some Gadgets in it and try to resize it bigger.
You will see that all Gadgets that will be placed or drawn over the actual original size dont be updated/ drawn again.
Still waiting for a fixed Version from Fred, but till yet, no response.
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
Here's an updated version of my code, which works with v4.10 Beta 3.
Run it, then click and drag the lower-right corner, and move it around.
.
Here's an updated version of my code, which works with v4.10 Beta 3.
Run it, then click and drag the lower-right corner, and move it around.
Code: Select all
Form1_W=312 ; Form's client width.
Form1_H=213 ; Form's client height.
Global Form1_hWnd,Form1_OrigW,Form1_OrigH
#Form1_Flags=#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget|#PB_Window_SystemMenu
Form1_hWnd=OpenWindow(0,200,200,Form1_W,Form1_H,"Form1",#Form1_Flags)
If Form1_hWnd=0 Or CreateGadgetList(Form1_hWnd)=0 : End : EndIf
SmartWindowRefresh(0,#True)
Form1_OrigW=WindowWidth(0) ; Original non-client width.
Form1_OrigH=WindowHeight(0) ; Original non-client height.
#Form1_Command1=1 : Form1_Command1_hWnd=ButtonGadget(#Form1_Command1,8,8,81,33,"Command1")
#Form1_Command2=2 : Form1_Command2_hWnd=ButtonGadget(#Form1_Command2,224,8,81,33,"Command2")
#Form1_Command3=3 : Form1_Command3_hWnd=ButtonGadget(#Form1_Command3,120,88,81,33,"Command3")
#Form1_Command4=4 : Form1_Command4_hWnd=ButtonGadget(#Form1_Command4,8,176,81,33,"Command4")
#Form1_Command5=5 : Form1_Command5_hWnd=ButtonGadget(#Form1_Command5,224,176,81,33,"Command5")
Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
Result=#PB_ProcessPureBasicEvents
Select Message
Case #WM_SIZE ; Form's size has changed.
Form1_RatioW.f=WindowWidth(0)/Form1_OrigW ; Get horizontal difference.
Form1_RatioH.f=WindowHeight(0)/Form1_OrigH ; Get vertical difference.
ResizeGadget(#Form1_Command1,8*Form1_RatioW,8*Form1_RatioH,81*Form1_RatioW,33*Form1_RatioH)
ResizeGadget(#Form1_Command2,224*Form1_RatioW,8*Form1_RatioH,81*Form1_RatioW,33*Form1_RatioH)
ResizeGadget(#Form1_Command3,120*Form1_RatioW,88*Form1_RatioH,81*Form1_RatioW,33*Form1_RatioH)
ResizeGadget(#Form1_Command4,8*Form1_RatioW,176*Form1_RatioH,81*Form1_RatioW,33*Form1_RatioH)
ResizeGadget(#Form1_Command5,224*Form1_RatioW,176*Form1_RatioH,81*Form1_RatioW,33*Form1_RatioH)
EndSelect
ProcedureReturn Result
EndProcedure
SetWindowCallback(@MyWindowCallback())
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by MrVainSCL.
Hi PB
Nice example... but as i remember correct on tranquil´s and my project, the PB bug was, when úsing a PanelGadget and to use inside this another PanelGadget too!? Mhhh.. We will see, what tranquil say to this
PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...
greetz
MrVainSCL! aka Thorsten
Hi PB
Nice example... but as i remember correct on tranquil´s and my project, the PB bug was, when úsing a PanelGadget and to use inside this another PanelGadget too!? Mhhh.. We will see, what tranquil say to this
PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...
greetz
MrVainSCL! aka Thorsten
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
Hi PB.
Your example works fine and the bug did not pop up. I think its couse that I use the ResizeGadget command, and this definitly do not do his work fine in my source.
For now, I will use your methode. Thanks a lot for this tip!!
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
Hi PB.
Your example works fine and the bug did not pop up. I think its couse that I use the ResizeGadget command, and this definitly do not do his work fine in my source.
For now, I will use your methode. Thanks a lot for this tip!!
Mike
Tranquilizer/ Secretly!
Registred PureBasic User