Capture ListIconGadget

Just starting out? Need help? Post your questions and find answers here.
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Capture ListIconGadget

Post by Peyman »

there is a way to capture a listicon gadget with all of its row and columns ?

thanks.
Sorry for my bad english.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 641
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Capture ListIconGadget

Post by captain_skank »

Simplest way i know is to cycle though each row and dump it to an array.
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Re: Capture ListIconGadget

Post 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 ?
Sorry for my bad english.
gabriel
Enthusiast
Enthusiast
Posts: 137
Joined: Sat Aug 01, 2009 4:49 pm
Location: Beirut, Lebanon

Re: Capture ListIconGadget

Post 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 ...)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: Capture ListIconGadget

Post 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
Egypt my love
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Re: Capture ListIconGadget

Post by Peyman »

Thanks RASHAD, good job, nice idea
Sorry for my bad english.
Post Reply