Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Question ? please help

jade1jade1 Member Posts: 59
I have written an event handler for a button that will convert the temperature in celsius.i have 2 labels that need to display information based on the following table

Celsius | Gas Mark | Description
0-100 | out range|
100-159 | 2 | slow oven
160-199 | 4 | moderate

the problem is that i can only display one label at a time
here is my code

case sedCelsius of
0..100 : lblGas.Caption = 'out range'
101..159 : lblGas.Caption = '2'
160..199 : lblGas.Caption = '4'

how do i now at the same time update my lblDescrition with the relevant data.




Comments

  • zibadianzibadian Member Posts: 6,349
    : I have written an event handler for a button that will convert the temperature in celsius.i have 2 labels that need to display information based on the following table
    :
    : Celsius | Gas Mark | Description
    : 0-100 | out range|
    : 100-159 | 2 | slow oven
    : 160-199 | 4 | moderate
    :
    : the problem is that i can only display one label at a time
    : here is my code
    :
    : case sedCelsius of
    : 0..100 : lblGas.Caption = 'out range'
    : 101..159 : lblGas.Caption = '2'
    : 160..199 : lblGas.Caption = '4'
    :
    : how do i now at the same time update my lblDescrition with the relevant data.
    :
    :
    You can use begin-end to create statement blocks. These are compiled as 1 statement. For example:
    [code]
    case sedCelsion of
    0..100: begin
    lblGas.Caption := 'out range';
    lblDescription.Caption := 'no info';
    end;
    [/code]
    This will change both labels. Note: this also works for the following statements:
    - for-do
    - while-do
    - with-do
    - if-then
Sign In or Register to comment.