Displaying a gadget partially outside its window

Windows specific forum
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Displaying a gadget partially outside its window

Post by merendo »

Hello fellow freaks!

I have a problem, which is as follows: I want to display a ListViewGadget, but it is larger than the window which it is assigned to. I would like the gadget to extend outside this window and the part that is outside the window should still be displayed instead of just being cropped.

Is there a way to do this? Searching these forums as well as the purearea.net code archive hasn't turned up anything.

Thanks for any help!!!
merendo
The truth is never confined to a single number - especially scientific truth!
PureLust
Enthusiast
Enthusiast
Posts: 478
Joined: Mon Apr 16, 2007 3:57 am
Location: Germany, NRW

Re: Displaying a gadget partially outside its window

Post by PureLust »

merendo wrote:I want to display a ListViewGadget, but it is larger than the window which it is assigned to. I would like the gadget to extend outside this window and the part that is outside the window should still be displayed instead of just being cropped.
Image what exactly do you mean?
Showing parts of the Gadget outside the Window, or be able to scroll inside the window to view the rest of the ListViewGadget()?
If you want the 2nd thing (scrolling within the Window), ScrollAreaGadget() is your fiend.
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: Displaying a gadget partially outside its window

Post by Vera »

Hello merendo,

I'm also unsure if you want the impossible :?

Why not make the window resizable ?
or use tootips that exceed the window by themselfs ?
or make your ListView a separate childwindow ?
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Re: Displaying a gadget partially outside its window

Post by merendo »

Here's what I want:

Code: Select all

  If OpenWindow(0, 0, 0, 270, 140, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ListViewGadget(0, 10, 10, 250, 200)
    For a = 1 To 12
      AddGadgetItem (0, -1, "Item " + Str(a) + " of the Listview") ; define listview content
    Next
    SetGadgetState(0, 9) ; set (beginning with 0) the tenth item as the active one
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
But I would like the ListViewGadget to be fully visible, ie to extend outside the window boundaries. Right now, it's just being cropped. Is there a way to do this?
The truth is never confined to a single number - especially scientific truth!
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Displaying a gadget partially outside its window

Post by DoubleDutch »

You can't extend out of the window, but see PureLust's post:
If you want the 2nd thing (scrolling within the Window), ScrollAreaGadget() is your fiend.
That is a BIG clue on how to get pretty much what you want...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: Displaying a gadget partially outside its window

Post by TomS »

By far not perfect, but maybe it's enough for you to work with.

Code: Select all

OpenWindow(0, 0, 0, 270, 140, "Main", #PB_Window_SystemMenu)
	ButtonGadget(0, 5, 5, 200, 50, "button")

OpenWindow(1, 100, 100, 250, 200, "", #PB_Window_BorderLess)
	ListViewGadget(1, 0, 0, 250, 200)

For a=1 To 10
	AddGadgetItem(1, 0, Str(a))
Next 

Repeat
	event = WaitWindowEvent(20)
	Select event
	Case #PB_Event_MoveWindow
		If EventWindow()=0
			ResizeWindow(1, WindowX(0)+100, WindowY(0)+100, #PB_Ignore, #PB_Ignore )
			SetActiveWindow(1)
		EndIf 
		
	Default 
		SetActiveWindow(1)
		
	EndSelect 
	
Until event=#PB_Event_CloseWindow
End 
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Re: Displaying a gadget partially outside its window

Post by merendo »

Yes, that's how I've solved the problem now. I am still not entirely satisfied, as it creates a weird look when the parent window is moved, but I guess it'll have to do. Thanks for your code anyway.
The truth is never confined to a single number - especially scientific truth!
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Re: Displaying a gadget partially outside its window

Post by einander »

Hi Merendo:
With a callback you can avoid the weird look when the parent window is moved.

Code: Select all

Procedure WinCB1(hWnd, Msg, wParam, lParam) 
  Select msg
    Case #WM_MOVE,#WM_MOVING 
      If EventWindow()=0
        ResizeWindow(1, WindowX(0)+120, WindowY(0)+50, #PB_Ignore, #PB_Ignore )
      EndIf
    Default
  EndSelect
  ProcedureReturn #PB_ProcessPureBasicEvents 
EndProcedure 


OpenWindow(0, 0, 0, 270, 60, "Main", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
BtnShowHide=ButtonGadget(-1, 5, 5, 100, 20, "Show Gad",#PB_Button_Toggle)
BtnClose=ButtonGadget(-1, 5, 35, 100, 20, "Quit")

OpenWindow(1,  WindowX(0)+120, WindowY(0)+50, 250, 200, "", #PB_Window_BorderLess|#PB_Window_Invisible)
StickyWindow(1,1)
ListViewGadget(1, 0, 0, 250, 200)

For a=1 To 10
  AddGadgetItem(1, 0, Str(a))
Next
SetWindowCallback(@WinCb1())

Repeat
  If GetAsyncKeyState_(27)&$8000 :  End : EndIf
  ev = WaitWindowEvent(1)
  Select ev
    Case #PB_Event_Gadget
      Select EventGadget()
        Case BtnClose:Break
        Case BtnShowHide
          HideWindow(1, GetGadgetState(BtnShowHide)!1)
      EndSelect
  EndSelect
Until ev=#PB_Event_CloseWindow
End 
Cheers!
Post Reply