DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

combobox inside a table

Hi, my purpose is to define a table that has two columns, one contains channels names found in a file and the other column is defined as a ComboBox type in order that the user can chose what to do with this channel… (in this case to choose Front or Rear)

 

To do this I defined in a VAS file two variables as follows:

 

ChannelsNames_ : F [100]

OffsetType_ : A ('Front', 'Rear') <'Front'>

 

I have no problems to pass the ChannelsNames_ variable to the table, but I don’t find out how to manage to pass the variable to the column defined as a ComboBox…

 

Please some suggestions will be appreciated,

 

Thanks in advance,

 

0 Kudos
Message 1 of 9
(4,180 Views)
hi,
 
there is only one smal change in your variable-definitions nessesary:
 
OffsetType_ : A [100] ('Front', 'Rear') <'Front'>
 
If you connect the second column with this variable, the second column shows automaticaly a combo box in each line.
 
by
A. Weiland
 

Andreas Weiland
Projektingenieur
measX GmbH & Co. KG
, www.measX.com
0 Kudos
Message 2 of 9
(4,170 Views)

Hi, thanks you are right I saw the mistake this morning... but I still having problems, hope you can continue helping me:

 

Now the problem is how to modify the value when the user selects “Front” or “Rear”…

What I mean is that for the Channels Names I do the following:

 

For i=1 To CNo("Free")-1

            ChannelsNames_(i) = Cn(i)

Next

 

Now the problem is that when the user modifies the value in the column defined as a ComboBox I have to catch if “Front” or “Rear” is selected and to store the new value in the variable OffsetType_ and I don’t know how to do it. I know how to find the selected cell, but not the selected value of the ComboBox cell.

 

I will appreciate your help again.

 

Thanks,

Marc.

0 Kudos
Message 3 of 9
(4,161 Views)
hi Marc,
 
in the same way you write the array-variable "ChannelsNames_(i)" you can access the array-variable "OffsetType_(i)" after the dialog.

For i=1 To CNo("Free")-1
  ChannelsNames_(i) = Cn(i)
Next
sudDlgShow(...)
For i=1 To CNo("Free")-1
  if OffsetType_(i) = "Front" then
    doAnything_with_front_channel(i)     ' for channel i user chose "Front"
  else
    doAnything_with_rear_channel(i)      ' for channel i user chose "Rear"
  end if
Next
 
hope that helps
 
 

 

Andreas Weiland
Projektingenieur
measX GmbH & Co. KG
, www.measX.com
0 Kudos
Message 4 of 9
(4,147 Views)

Thanks for the try, but I think that you didn’t understood my problem, I'll try to explain it better:

 

Now the table shows the found channels in one column and in the other you can chose / select “None”, “Front” or “Rear” (I added one more item) in the ComboBox cells. Thing is that when user chooses a new value is not stored directly into the OffsetType_ and the variable remains with the original value. Then to store the chosen option by the user (None”, “Front” or “Rear”) into the OffsetType_ I need to know the line selected on the ComboBox and I don’t find the way to do that due that is inside the table…

 

Using SelColumn and SelRow or using SelectedCells I can locate the cell that is being modified but how can I know the chosen line or value of the ComboBox inside the cell? Knowing this I can store the value into the corresponding OffsetType_(i).

 

Hope it’s clear now, and you can help me, if not we will try again,

Thank you very much.

0 Kudos
Message 5 of 9
(4,138 Views)
hmmm ... try to understand your problem ...
I dont agree with your sentence:
"Thing is that when user chooses a new value is not stored directly into the OffsetType_ and the variable remains with the original value."
Depends on how you close the dialog. If you close the dialog with a Cancel-Button (button-type = cancel) or the command "dialog.cancel" or the red cross in the right-upper corner of the window, then all DIAdem-variables linkt to the dialog will set to the old values.
If you close the dialog with a OK-Button (button-type = OK) or the command "dialog.ok" then you have the user selected values in all viewed variables in the dialog.
is this your problem?

Andreas Weiland
Projektingenieur
measX GmbH & Co. KG
, www.measX.com
0 Kudos
Message 6 of 9
(4,121 Views)

It isn’t my problem…

 

Ok, I think that if you check the attached code that as you will see it's very simple... In your screen will appear a dialog showing a table with one column and each cell contains a ComboBox. The column is assigned to the OffsetType_() variable that we are talking about... If you select any cell you can go into the ComboBox options, but there is no way to select any of the possible options. The value of the cell remains as it was at the beginning, and then of course when you exit the dialog... nothing happens...

 

Is this a DIAdem bug? or we are forgetting something?

Or how we can know the line of the ComboBox that the user is selecting?

 

Please try,

0 Kudos
Message 7 of 9
(4,111 Views)

ok, i see your problem:
For each column in your tabel you can chooes a option called "read only".
If the checkbox ist set, the column appears grey and you can not change a value in this column.
Clear the checkbox and the column then is no longer grey.

🙂

 


Andreas Weiland
Projektingenieur
measX GmbH & Co. KG
, www.measX.com
Message 8 of 9
(4,104 Views)

Thank you very much Andreas, finally you solved my problem... you are the Best :))

 

I'm using DIAdem 8.1 because most of my collages have this version and they will use my code. How DIAdem 8.1 doesn’t show the table in grey if it's "read only" I didn’t realise about my mistake. When I did the example for you I used DIAdem 9.1 that actually I only use to make colourmaps, I saw the table in grey colour but I was on a hurry and thought is not important... but not that was the key of my problem…

 

Thanks again Andreas,

Marc.

0 Kudos
Message 9 of 9
(4,095 Views)