cXtra - Xtra for Macromedia Director
  Create an account
•  Home  •  Downloads  •  Your Account  •  Forums  •
 cXtra 
· Home
· Contact
· Downloads
· FAQ
· HowToRegister
· News Archive
· Order
· Polls
· Products
· Support forum
· Your Account
 Products 

· Description of cXtraStringGrid
· History of cXtraStringGrid
· How to use cXtraStringGrid
· Note for Version 1.x users
· Screenshots of cXtraStringGrid used in a user project
· Tip: Go to another marker or movie from a click on the cXtraStringGrid
· Tip: How to use V3 objects in the grid?
· Tip: Use cXtraStringGrid with a V12 database
· Tip: Use cXtraStringGrid with a Valentina database
Tip: How to use V3 objects in the grid?





There are two kinds of objects in the grid:

  • Buttons, checkbox
    • Are always visible on the grid
  • ComboBox, EditFilters, DatePicker, TimePicker
    • Are only visible on the grid when you enter in Edition mode by double clicking on a cell
    • Editors are not saved par cell in order to use less memory so you should use the GetEditorType event to set the editor in a cell

 

Buttons

Buttons can be added with:

  • sprite(1).SetbuttonHere(2,2,true)

And deleted with:

  • sprite(1).SetbuttonHere(2,2,false)

You can trap the event when a user click on a button with:

  • on ButtonClick me, col, row
  • put "Button clicked on cell ("&col&","&row&")"
  • end

Checkbox

Checkbox can ba added with:

  • sprite(1).SetCheckBoxHere(2,2,true)

And deleted with:

  • sprite(1).SetCheckBoxHere(2,2,false)

You can set the state with:

  • sprite(1).SetChecked(2,2,true)

And get the state with:

  • put sprite(1).GetChecked(2,2)

ComboBox, EditFilters, DatePicker, TimePicker

We don't associate an editor to a cell in the xtra to preserve the memory: for example, it's useless to see the combobox in the grid until you are in Edition mode, only the selected value is important.

So you set the editor with the GetEditorType event which is called each time the user enter in the Edition mode in the grid:

  • on GetEditorType me, ACol, ARow

This script is a movie script, it's not a behavior on the sprite.
You can choose one value between:

    • Edit = 0
    • ComboEdit = 1
    • ComboList = 2
    • DatePicker = 3
    • TimePicker = 4
    • CheckBox = 5
    • EditNumber = 6 -- allow characters [0-9] + the decimal character (specified in the decimalseparator property)
    • EditFilter = 7 -- allow characters specified in the EditFilter property
    • Button = 8

And return this value to set the Editor. For example, this code place a combobox in the cell (2,2) when the user doubleclick on this cell:

  • on GetEditorType me, col, row
  •  if col=2 and row=2 then
  •   return 2 -- show ComboList on cell (2,2)
  •  end if
  • end

In this example, the combobox is empty, you can fill it with:

  • on GetEditorType me, col, row
  •  if col=2 and row=2 then
  •   sprite(1).ClearCombo()
  •   sprite(1).AddComboItem("Red","Green","Blue")
  •   return 2 -- show ComboList on cell (2,2)
  •  end if
  • end

You can download the demo in the Download section to see this code in action.

 




Click here to go to the download section.

Click here to order this product.






Copyright © by cXtra - Xtra for Macromedia Director All Right Reserved.

Published on: 2006-11-28 (0 reads)

[ Go Back ]
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2002-2007 by www.cXtra.net

Page Generation: 0.198 Seconds

:: skyLineBlue phpbb2 style by Volize Web Solutions :: PHP-Nuke theme by www.nukemods.com ::