It is currently Wed May 22, 2013 6:52 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: ListIconGadget Get and Set GadgetitemData[done]
PostPosted: Wed Feb 29, 2012 2:01 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
The ListIconGadget Get & Set GadgetitemData routines
don't appear to be working 4.61b ubuntu 11.10

Code:
list=1
Procedure addimg(pos)
  Protected timg
   
  timg= CreateImage(#PB_Any,64,64)
  StartDrawing(ImageOutput(timg))
    r =Random(127)+127
    g=Random(127)+127
    b=Random(127)+127
    Box(0,0,64,64,RGB(R,g,b))
  StopDrawing()
 
  AddGadgetItem(#list,pos,Str(pos),ImageID(timg))
  SetGadgetItemData(#list,pos,pos)
  ;Debug GetGadgetItemData(#list,pos)
   
  ProcedureReturn img
EndProcedure

OpenWindow(0,0,0,200,500,"")
ListIconGadget(1,5,5,190,490,"",190)
For a = 1 To 10
  addimg(a)
Next

Repeat
  EV = WaitWindowEvent()
  Select EV
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #list
          Select EventType()
            Case #PB_EventType_Change
                item = GetGadgetState(#list)
                Debug GetGadgetItemData(#list,item)
            EndSelect     
        EndSelect
   EndSelect
Until EV = #PB_Event_CloseWindow



Last edited by idle on Wed Feb 29, 2012 7:31 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: ListIconGadget Get and Set GadgetitemData
PostPosted: Wed Feb 29, 2012 7:58 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2854
Location: Wales, UK
The test snippet does not work on WinXP 32 either, data is returned as zero.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: ListIconGadget Get and Set GadgetitemData
PostPosted: Wed Feb 29, 2012 8:19 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
First item is 0 and not 1 :wink:
Code:
OpenWindow(0,0,0,200,500,"")
ListIconGadget(1,5,5,190,490,"",190)
For a = 0 To 9
  addimg(a)
Next

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: Re: ListIconGadget Get and Set GadgetitemData
PostPosted: Wed Feb 29, 2012 7:30 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
ts-soft wrote:
First item is 0 and not 1 :wink:
Code:
OpenWindow(0,0,0,200,500,"")
ListIconGadget(1,5,5,190,490,"",190)
For a = 0 To 9
  addimg(a)
Next


:oops:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye