s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Visiblity option utilization

nguzeldere opened this issue · comments

İf visibile/invisible option is available for controls it would be nice to include some description in the documentation and also provide application examples.

Already exists check:

`
uint16_t tabHome = ESPUI.addControl( ControlType::Tab, "HOME 🏡", F("HOME 🏡") );

timeLabel = ESPUI.addControl(ControlType::Label, "TIME ", F(""), COLOR_WETASPHALT, tabHome );

ESPUI.getControl(timeLabel)->visible = 0;
ESPUI.updateControl(timeLabel);

// update component
ESPUI.jsonDom(0);`

also you can get it to visible to true with = 1;

etc..

I hope it helps :)
Marc.

This will work, but the ESPUI.jsonDom(0) is forcing an entire refresh of the GUI which is using a sledgehammer to crack a nut. It shouldn't be hard to update visibility manually. Let me have a look.

Update: Yeah, it's just a case of adding the following into style.css at line 578

if(data.hasOwnProperty('visible')) {
  if(data['visible']) 
    $("#id" + data.id).show();
  else
    $("#id" + data.id).hide();
}

I'll work this into a commit and update the documentation.

Added to this pull request.

As per the documentation, once this is merged in, you'll just have to call updateVisibility.

Thank YOu :)

Have a nice day.
Marc.

Added to this pull request.

As per the documentation, once this is merged in, you'll just have to call updateVisibility.

That would be great, thank you in advance..