Page 2 of 2

Posted: Sun Apr 13, 2008 12:29 pm
by Derek
Unfortunately #pb_window_maximised doesn't extend the window fully to the right but it does extend it under the taskbar so part of the gadget is hidden.

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_SizeGadget) 
CreateGadgetList(WindowID(0)) 
y=WindowHeight(0)
TextGadget(0,100,y-20,100,20,"can you see me",#PB_Text_Border)
Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow 
      Break 
  EndSelect 
ForEver

Posted: Sun Apr 13, 2008 2:32 pm
by Trond
Derek wrote:Unfortunately #pb_window_maximised doesn't extend the window fully to the right but it does extend it under the taskbar so part of the gadget is hidden.

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_SizeGadget) 
CreateGadgetList(WindowID(0)) 
y=WindowHeight(0)
TextGadget(0,100,y-20,100,20,"can you see me",#PB_Text_Border)
Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow 
      Break 
  EndSelect 
ForEver
1. It does go fully to the right. If it doesn't, then something is wrong on your end.
2. If you remove #PB_Window_SizeGadget (which was done in my first example) then YES, I can see the gadget.
However, with your code, a gadget placed at that position would NOT be visible. So I added #PB_Window_SizeGadget and then my code creates a window the same size as yours. The real reason the gadget doesn't show in your example is that WindowHeight() returns the wrong value. The window still has the size you wanted.

Posted: Sun Apr 13, 2008 3:12 pm
by Derek
Well using this code with windows vista business only stretches near to the corner.

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_SizeGadget) 
CreateGadgetList(WindowID(0)) 

Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow 
      Break 
  EndSelect 
ForEver
http://www.dlwebsite.pwp.blueyonder.co.uk/topright.bmp

Also, having windowheight() return the wrong size doesn't help. :lol:

Posted: Sun Apr 13, 2008 3:20 pm
by Trond
You should post a bug report about the window not maximizing properly. It should really fill out to the corner.

Posted: Sun Apr 13, 2008 3:26 pm
by Derek
Anyone else getting this with Vista? Presumably it works ok with XP.

Posted: Sun Apr 13, 2008 4:27 pm
by Sparkie
Derek wrote:Anyone else getting this with Vista?
No problem here with Vista HomePremium.

Now that I see exactly what it is you're looking for, I modified my original code...
Window is max size with borders and all gadgets being visible
Window cannot be moved
SysMenu item Move is disabled
Taskbar location (left/right/top/bottom) is taken into account

Code: Select all

SystemParametersInfo_(#SPI_GETWORKAREA,0,@screen.RECT,0) 
captionheight=GetSystemMetrics_(#SM_CYCAPTION) 
borderwidth=GetSystemMetrics_(#SM_CXFIXEDFRAME) 
borderheight=GetSystemMetrics_(#SM_CYFIXEDFRAME) 
windowwidth=screen\right-screen\left-(borderwidth*2) 
windowheight=screen\bottom-screen\top-captionheight-(borderheight*2) 
windowx=screen\left
windowy=screen\top
Procedure.l WinCallback(hwnd,msg,wParam,lParam) 
  result=#PB_ProcessPureBasicEvents 
  Select msg 
    Case #WM_WINDOWPOSCHANGING
      result=0
  EndSelect 
  ProcedureReturn result 
EndProcedure 

Procedure.l DisableMenuMove(hwnd)
  hMenu=GetSystemMenu_(hwnd,0)
  mii.MENUITEMINFO
  mii\cbSize=SizeOf(MENUITEMINFO)
  mii\fMask=#MIIM_STRING
  mii\dwTypeData=0
  GetMenuItemInfo_(hMenu,#SC_MOVE,0,@mii.MENUITEMINFO)
  mItem$ = Space(mii\cch+1)
  mii\dwTypeData=@mItem$
  mii\cch+1
  GetMenuItemInfo_(hMenu,#SC_MOVE,0,@mii.MENUITEMINFO)
  ModifyMenu_(hMenu,#SC_MOVE,#MF_GRAYED|#MF_BYCOMMAND,0,mItem$)
  DrawMenuBar_(hwnd)
EndProcedure
  
OpenWindow(0,windowx,windowy,windowwidth,windowheight,"",#PB_Window_SystemMenu) 
CreateGadgetList(WindowID(0)) 
ButtonGadget(0,0,0,100,100,"") 
ButtonGadget(1,WindowWidth(0)-100,0,100,100,"") 
ButtonGadget(2,0,WindowHeight(0)-100,100,100,"") 
ButtonGadget(3,WindowWidth(0)-100,WindowHeight(0)-100,100,100,"") 
DisableMenuMove(WindowID(0))
SetWindowCallback(@WinCallback())
Repeat 
  
Until WaitWindowEvent()=#PB_Event_CloseWindow 

Posted: Sun Apr 13, 2008 5:18 pm
by rsts
Dereks code = close but not quite filled.

Sparkie's code = filled completely.

Vista64 ultimate.

cheers

Posted: Sun Apr 13, 2008 8:52 pm
by Derek
Thanks Sparkie, works great. :D

Posted: Mon Apr 14, 2008 12:44 pm
by blueznl
rsts wrote: Vista64 ultimate.
Perhaps a Vista64 issue?

Posted: Mon Apr 14, 2008 12:58 pm
by Derek
No, mines vista 32. I posted a bug report and freak had a solution.