-->
Page 1 of 2

change button style's

PostPosted: Fri Dec 23, 2016 3:15 pm
by mariolatronico
HI,
I have tried to change button style's in toggle function with this code:
Code: Select all'file: ESP12_Test_ToggleButton
'firmware:  ESP Basic 3.0.Alpha 65

cls
memclear

wprint |<BR>|
button "Toggle <BR> PO0", [tglPO0]
 chMyColorID = htmlid()                   'memorize button's ID
cssid  chMyColorID, "font-size: 24px"
cssid  chMyColorID, "border-radius: 10px"
cssid  chMyColorID, "border: 10px solid silver"
cssid  chMyColorID, "background-color: silver"
cssid  chMyColorID, "border-style: outset"

 io(po,0,1)
wprint |<BR>|
wprint "Turn Zero (lime):"
textbox  turnZero
wprint |<BR>|
wprint "Turn One (grey):"
textbox   turnUno
wait

[tglPO0]
if io(laststat,0) = 1 then
cssid  chMyColorID, "border: 10px solid green"
 cssid  chMyColorID, "background-color: lime"
 cssid  chMyColorID, "border-style: inset"
 cssid  chMyColorID, "font-weight: bold"
 io(po,0,0)
turnZero = turnZero + 1
else
cssid  chMyColorID, "border: 10px solid grey"
 cssid  chMyColorID, "background-color: silver"
 cssid  chMyColorID, "border-style: outset"
 cssid  chMyColorID, "font-weight: normal"
 io(po,0,1)
turnUno = turnUno + 1
end if
wait


Function is OK for some click before crash.
This is message from serial port

Exception (28):
epc1=0x4000bf0e epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff3050 end: 3fff34a0 offset: 01a0

>>>stack>>>
3fff31f0: 00000000 3fff32d8 3fff3220 4022ba34
3fff3200: 00000000 3fff32d8 3fff1c60 4022ba76
3fff3210: 3fffbb7c 3fff32d8 3fff1c60 4020b4ba
3fff3220: 00000000 00000000 00000000 3fff9d94
3fff3230: 00000a1f 00000a1e 3fff32d8 4022ba34
3fff3240: 4026dbc0 00000000 00000001 4022ba5c
3fff3250: 00000000 00000000 00000001 402187b7
3fff3260: 3fff5dfc 0000000f 0000000b 3fffbbec
3fff3270: 0000001f 00000013 3fff85bc 0000000f
3fff3280: 00000000 3fff85d4 0000000f 00000000
3fff3290: 3fff816c 0000000f 00000000 3fff8184
3fff32a0: 0000000f 00000000 3fff819c 0000000f
3fff32b0: 00000000 3fff8514 0000000f 00000000
3fff32c0: 3fff852c 0000000f 00000000 3fff8544
3fff32d0: 0000000f 00000000 3fffbbb4 0000002f
3fff32e0: 0000002b 00000000 00000000 00000000
3fff32f0: 3fffbb7c 0000002f 0000002b 3fff246c
3fff3300: 00000010 3fff3390 00000000 4010053d
3fff3310: 3fff572c 3fff3390 3fff3390 4022b8ac
3fff3320: 00000020 00000001 3fff3390 3ffeff30
3fff3330: 00000010 3fff3390 3fff3390 4022b8ac
3fff3340: 3ffe8e2c 00000000 3fff3390 3fff246c
3fff3350: 3fff76e4 0000000f 00000000 3fff7784
3fff3360: 0000000f 00000000 3fff6b94 0000000f
3fff3370: 00000000 3fff855c 0000001f 00000011
3fff3380: 3fff6bdc 0000000f 00000007 3fff49cc
3fff3390: 0000000f 00000005 3fff33ec 4022b8fb
3fff33a0: 00000000 000008d7 00000000 00000000
3fff33b0: 3fffdad0 3fff1340 3fff33e0 4010068c
3fff33c0: ffffffff 3fff1340 3fff1c10 3fff2478
3fff33d0: 3fffdad0 3fff1340 3fff1c10 4021b91b
3fff33e0: 00000000 00000000 00000000 00000000
3fff33f0: 00000000 00000000 3fff5e2c 40220256
3fff3400: 00000001 00000000 00000000 4021bb7b
3fff3410: 00000000 3fff3430 3fff5e50 4021ff7c
3fff3420: 00000001 00000000 3fff5e2c 402214e9
3fff3430: 3ffe9588 00000000 000003e8 3fff2480
3fff3440: 00000000 00000000 00000000 3fff2478
3fff3450: 3fffdad0 00000000 3fff2470 4021bc0b
3fff3460: 00000000 feefeffe feefeffe feefeffe
3fff3470: 00000000 00000000 00000001 40229649
3fff3480: 3fffdad0 00000000 3fff2470 40229674
3fff3490: feefeffe feefeffe 3fff2480 40100718
<<<stack<<<


where i fail?
what do I can consider?
Merry christmas

Re: change button style's

PostPosted: Fri Dec 23, 2016 3:26 pm
by Mmiscool
every time you wprint css code it gets added to the bottom of the page.

Unfortunately that takes up the page buffer and it fills up over time with each change.

You can get around this by using cls and redrawing the gui with different css each time.

Hope this was helpful.

Re: change button style's

PostPosted: Fri Dec 23, 2016 4:01 pm
by mariolatronico
Hi, this is helpful, thanks.
Is possible to know an example for checking buffer page amount ?
the intent is to prevent the filling of the page buffer before automatic add graphic controls.
best regards

Re: change button style's

PostPosted: Sat Dec 24, 2016 12:08 pm
by Mmiscool
use the function ramfree() to return the amount of ram left.