Page 1 of 1

Working with data grids (clearing a datagrid)

Posted: Sat Jan 08, 2011 2:07 pm
by stevewhyte
Hi,

I hope someone can help. I have set up a data grid to store some arrays to do with graphics cards as follows:

-----------------------------------
// allow access to global arrays and variables set up in main card.
global arrayProductName
global arrayProductRam
global arrayProductClockSpeed
global arrayProductCost
global MaxVidCards

// set up local variables
local theVideoCardInfo
local CardCount

// When mouse up event is detected on this button then execute following,
on mouseUp

// zero number of video cards found
put 0 into CardCount

// clear text showing number of video cards found
put empty into field "TotalCardsFound"

// clear search type heading
put empty into field "SearchTypeHeading"

// display search type heading
put "Search: All Video Cards" into field "SearchTypeHeading"

// display all video cards
repeat with loop = 1 to MaxVidCards

// increment number of video cards displayed. This is also used to determine which line
// video card details appear within data grid.
add 1 to CardCount

// copy video card data from array to data grid
put arrayProductName[Loop] into theVideoCardInfo[CardCount]["name"]
put arrayProductRam[Loop] into theVideoCardInfo[CardCount]["memory"]
put arrayProductClockSpeed[Loop] into theVideoCardInfo[CardCount]["speed"]
put arrayProductCost[Loop] into theVideoCardInfo[CardCount]["cost"]
set the dgData of group "DataGrid 1" to theVideoCardInfo
end repeat

// display number of video cards found
put CardCount into Field "TotalCardsFound"

end mouseUp
-----------------------------------

However, I am after a command to clear the data grid once another button is selected. I've tried the put empty into data grid but that does not seem to work.

Cheers,

Steven

Re: Working with data grids (clearing a datagrid)

Posted: Sat Jan 08, 2011 5:42 pm
by Zryip TheSlug
Hi Steven,

Did you tried?:

Code: Select all

set the dgData of group "DataGrid 1" to empty

Best Regards,

Re: Working with data grids (clearing a datagrid)

Posted: Sun Jan 09, 2011 12:49 pm
by stevewhyte
Sorted, thanks!