Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

changeCheckBoxEnabled()

Mammad900 edited this page Aug 30, 2020 · 1 revision

changeCheckBoxEnabled(page, index, value)

Summary

Disables or enables a check-box

Parameters

  1. Page (int) : The number of the page which contains the check-box
  2. Index (int) : Index of the check-box relative to it's containing page.
  3. Value (bool) : If true, the check-box become enabled; if false, it will become disabled.

Returns

Nothing

Example

void targetTempChanged(int newTargetTemp){
    // .....
    if(newTargetTemp<22){ // Energy saving is impossible with temp lower than 22 degrees
        changeCheckBoxEnabled(PAGE_ADVANCED,ENERGY_SAVING_ENABLED,false);
    }
    else{
        changeCheckBoxEnabled(PAGE_ADVANCED,ENERGY_SAVING_ENABLED,true);
    }
    // .....
}

Output

When target temperature is set below 22 degrees, the energy saving check-box will become disabled (because it is not possible to save energy in this temp)

Source

void changeCheckBoxEnabled(int page,int i,bool val){
    if (checkbox_enabled[page][i] != val) {
        HCT
        checkbox_enabled[page][i] = val;
        if (CurrentPage == page){
            drawCheckBox(page,i);
        }
    }
}

Note: HCT is a macro for making the rest of the library aware that something has changed.

Clone this wiki locally