howto handle grid data

Started by grrrr, January 10, 2010, 07:31:49 AM

Previous topic - Next topic

grrrr

hi,

for using the grid control there a tree kinds of data for most styles.
- the external data, comming from user
- the label data, displayed as label
- the internal data controlled by dcl
also there is a external data called 'empty', 'not defined','missing' or somewhat else.

sample ckeckbox:
external data is:               0, 1 or empty
label is:                           ON, OFF, empty
dcl data for checkstate is:  T, nil, 'grayed out'

sample layer
external data is:      0, layer1, layer2,... with layer1, layer2,... not defined
label is:                  0, layer1, layer2,... with not defined layer 'grayed out'
dcl data for layer is: 0 and layers not defined ignored.

sample color
external data is:      1..255, 256, 0, empty
label is:                  1..255, bylayer, byblock, 'grayed out'
dcl-data for color:    1..255, 256, 0, ignored

the initialization for some types data can be changed by the user.
but if a field is clicked the user has to translate the remaining dcl data to label data.
if the choose is canceled the label data remains untouched.

how to do.




Fred Tomke

Hi, grrr, I'm not sure if I understood right. In my grids I save the old cell content or cell state that it is possible to restore the old cell content after cancelling.

Code (autolisp) Select

(defun c:MyProj_MyForm_MyGrid_OnBeginLabelEdit (nRow nCol)
  (setq lstCellEdit (list nRow nCol (dcl_grid_getcellText MyProj_MyForm_MyGrid nRow nCol)))
); c:MyProj_MyForm_MyGrid_OnBeginLabelEdit

(defun c:MyProj_MyForm_MyGrid_OnEndLabelEdit (nRow nCol)
  [evalute what to do, when content was changed]
  (setq lstCellEdit nil)
); c:MyProj_MyForm_MyGrid_OnEndLabelEdit

(defun c:MyProj_MyForm_OnCancelClose (isESCWasPressed)
  (if (= isESCWasPressed 1)
    (if lstCellEdit (dcl_grid_getcellText MyProj_MyForm_MyGrid nRow nCol (last lstCellEdit)))
  ); if
  (/= isESCWasPressed 1)
); c:MyProj_MyForm_OnCancelClose


Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

grrrr

hi fred,

mmh why cant opendcl handle this issue.
please have a look at my samples for grid i
sent in a previous mail.
if you choose line type column and label is vonlayer and
you are in a us version then vonlayer is handled as unknown
and set to blank even you choose something in the pulldown.
thats a good sample the localized vonlayer cant be translated
by getcname to bylayer. it returns nil. i have asked for dcl_<control>_onButtonClicked to translate values for checkboxes
but thats available only for type 4.
my problem is a pre and post translation of data residing as labeltext.
the orginal data may be vonlayer shown as bylayer in enu version
and bylayer given to pulldown function.
hope this helps for understanding


Fred Tomke

Hm, grr, I will have a test this evening.
BTW, are you German? Maybe some things are easier for me to explain...

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

grrrr

hi fred,

you are rigth, i am from germany.
what you explained is not what i mean.
you explained to cancel a form and restoring the old values.

have a look at the grid with columnstyle aclayer.
may be there are a label 0 and a label xxx.
'0' is a existing layer, 'xxx' layer doesnt exist.
click into 'xxx'  field, the pulldown appears.
then you click on field '0', the pulldown on 'xxx' disappears and the field
is empty. the pulldown on '0' appears and if you expand, layer '0' is presented.
how can i restore that value without pain.

a similar issue appears with the checkbutton type.
label values '0' and '1' are not voted as 'data' which drives the checkbox. the checkbox remains still checked or unchecked.
so i could set the label to ON/OFF or EIN/AUS if the event
_OnButtonClicked is availabel for all grid column styles.
then i can test the checkstate and change the label.

or
on linetype or lineweight the values bylayer or byblock can appear.
that values are localized values. because the appeare as localized
values ( on german autocad vonlayer, vonblock) they have to be translated before they are put to acui control. maybe as return value
of an event. also on return from acui-control that value has to be translated back too.

once more to make it clear.
there is external data show in the grid. maybe localized data( german, decimal comma instead of decimal point)
they have to be translated to data for the cad system maybe enu autocad and put to opendcl and back.

Fred Tomke

Hi, grr
Quote from: grrrr on January 13, 2010, 02:00:20 AM
how can i restore that value without pain.

the answer ist similiar to this what I've written before:

I save the current state before editing it. That makes it possible to restore in case of a wrong value. Save it in the OnBeginLabelEdit event and check the content in the OnEndLabelEdit event. If the new content is empty or wrong restore the old value. Do you know what I mean?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Quote from: grrrr on January 13, 2010, 02:00:20 AM
[...] the checkbox remains still checked or unchecked. [...]

Hm, if you check or uncheck a cell in checkbox style, the event OnStartLabelEdit will be fired - but not OnEndLabelEdit.
When I had this in my form, I check if the cell is in checkbox style and I invoke CancelCellEdit immediately to let OnEndLabelEdit fire.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Quote from: grrrr on January 13, 2010, 02:00:20 AM
there is external data show in the grid. maybe localized data( german, decimal comma instead of decimal point)

As far as I know AutoCAD only accepts only point as decimal delimiter (but not in the DataTable palette in FDO). There's no chance to change.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Quote from: grrrr on January 13, 2010, 02:00:20 AM
on linetype or lineweight the values bylayer or byblock can appear. that values are localized values. because the appeare as localized
values ( on german autocad vonlayer, vonblock) they have to be translated before they are put to acui control. maybe as return value
of an event.

You are right: they have to be translated by yourself. I do it so. As far as I remember I did not translate this in the ressource files, neither in SharedRes nor in RuntimeRes. That's why it must be given by the installed OS (what I don't believe) or by the started AutoCAD release.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]