Page 1 of 1

Capture ListIconGadget

Posted: Thu Apr 07, 2011 1:54 pm
by Peyman
there is a way to capture a listicon gadget with all of its row and columns ?

thanks.

Re: Capture ListIconGadget

Posted: Thu Apr 07, 2011 2:32 pm
by captain_skank
Simplest way i know is to cycle though each row and dump it to an array.

Re: Capture ListIconGadget

Posted: Thu Apr 07, 2011 3:07 pm
by Peyman
thank captain_skank but my mean from Capture is getting a picture, for example :

Code: Select all

 If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
   AddGadgetColumn(0, 1, "Address", 250)
   AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   Repeat
     Event = WaitWindowEvent()
   Until Event = #PB_Event_CloseWindow
 EndIf
you see 2 row drops down and some details from seconds column that you can see them with scroolbars, so i want get a picture from all content of listbox without scrollbars, any body know a way ?

Re: Capture ListIconGadget

Posted: Thu Apr 07, 2011 7:06 pm
by gabriel
You can use a graphic capture software for that like faststone
http://www.faststone.org/FSCapturerDownload.htm
if you want to use from your PB program, you should search for a similar which can be run in command line mode. (so you can use RunProgram ...)

Re: Capture ListIconGadget

Posted: Thu Apr 07, 2011 8:29 pm
by RASHAD
Hi
Adapt it for your needs

Code: Select all

Prototype.i p_PrintWindow(hWnd, hdc, flags)

OpenLibrary(1, "User32.dll")
PrintWindow.p_PrintWindow = GetFunction(1, "PrintWindow")


If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
   AddGadgetColumn(0, 1, "Address", 250)
   AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
   
   Result = CountGadgetItems(0)
   SendMessage_(GadgetID(0), #LVM_GETITEMRECT, Result - 1,r.RECT)
   ResizeWindow(0,#PB_Ignore,#PB_Ignore,r\right+40,r\bottom+30)
   ResizeGadget(0,#PB_Ignore,#PB_Ignore,r\right+30,r\bottom+20)
   
  If CreateImage(1,r\right+30,r\bottom+20, 24)
    hdc = StartDrawing(ImageOutput(1))
    If hdc
      PrintWindow(GadgetID(0), hdc, 0)
      StopDrawing()
    EndIf
  EndIf
  
  SaveImage(1,"f:\savetest.bmp")
   
  ResizeGadget(0,#PB_Ignore,#PB_Ignore,290,90)
  ResizeWindow(0,#PB_Ignore,#PB_Ignore,300,100)
  InvalidateRect_(GadgetID(0),0,#True)

   Repeat
     Event = WaitWindowEvent()
   Until Event = #PB_Event_CloseWindow
EndIf

Re: Capture ListIconGadget

Posted: Fri Apr 08, 2011 5:29 pm
by Peyman
Thanks RASHAD, good job, nice idea