How can I change the Checked State of the checkbox from Code?
chkRecalEnabled.Checked := True;
DrawCheckBox(@chkRecalEnabled);
The above code does not change the unchecked checkbox to checked.
CheckBox problem
CheckBox problem
JohnB
MikroPascal for PIC18 and DsPIC, Visual TFT
MikroPascal for PIC18 and DsPIC, Visual TFT
Re: CheckBox problem
The checked value is not true (all bits =1), but 1 (only lowest bit 1), this applies to all flags used in VTFT. Personally, I try to avoid use of the True/False assignments in my mpsdPIC code; historically the true value has changed with different versions of the compiler. Using and testing for 0 and 1 is much safer - that is when one does not forget about it and use the boolean as in other pascal compilers, which I see myself doing from time to time...
Code: Select all
chkRecalEnabled.Checked := 1;
DrawCheckBox(@chkRecalEnabled);
mikropascal dsPIC, Visual TFT, MMBdsPIC v.105, 1.10_9A, mikroProg, "Big"(P30F6012A)EasydsPIC2
Re: CheckBox problem
Thanks for tip.
That also explains why
didn't work.
That also explains why
Code: Select all
chkRecalEnabled.Checked := (SerialFlash_ReadByte(0) = $FF);
JohnB
MikroPascal for PIC18 and DsPIC, Visual TFT
MikroPascal for PIC18 and DsPIC, Visual TFT
Re: CheckBox problem
Hi guys,
Here is a trick I use in every project now to avoid this problem:
In the user code area for declarations, I assign my own constants for using in places where the code sets or checks a objects property like so-
(Basic version code)
This is for easier reading of the code somewhere down the line as it still looks like conventional usage of the keywords.
Hope this helps, Robert.
Here is a trick I use in every project now to avoid this problem:
In the user code area for declarations, I assign my own constants for using in places where the code sets or checks a objects property like so-
(Basic version code)
Code: Select all
const bTRUE as byte = 1
const bFALSE as byte = 0
Hope this helps, Robert.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|
SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|
SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|
Re: CheckBox problem
Yes, I agree, it does make reading the code easier, however, you still need to remember when you should use the bTrue/bFalse in place of the True/False. I just hadn't spotted that the logical states in the V-TFT controls use a bit not a full byte, why I don't know because when you set the e.g the active state in VTFT is says true or false. Another inconsistency!
JohnB
MikroPascal for PIC18 and DsPIC, Visual TFT
MikroPascal for PIC18 and DsPIC, Visual TFT
Re: CheckBox problem
Hello,
changing the way how Visual TFT generates property values from 0/1 to False/True would break the backward compatibility.
However, we can change what is accepted as True value (since 0 and False are already the same thing). To be precise, zero would be False and anything greater then zero would be acknowledged as True.
This way we will keep backward compatibility and users could write both 0/1 and True/False values to object properties (irrelevant of the architecture in question)
Best Regards
changing the way how Visual TFT generates property values from 0/1 to False/True would break the backward compatibility.
However, we can change what is accepted as True value (since 0 and False are already the same thing). To be precise, zero would be False and anything greater then zero would be acknowledged as True.
This way we will keep backward compatibility and users could write both 0/1 and True/False values to object properties (irrelevant of the architecture in question)
Best Regards
LibStock
http://www.libstock.com/
mikroSDK
https://www.mikroe.com/mikrosdk
mikroBUS
https://www.mikroe.com/mikrobus
http://www.libstock.com/
mikroSDK
https://www.mikroe.com/mikrosdk
mikroBUS
https://www.mikroe.com/mikrobus
Re: CheckBox problem
That would certainly be an improvement but does it address the following...
If VTHTControl.Active = True then ...
or
BooleanVar := VTHTControl.Active;
I guess if you are changing the compiler to accept both 1/0 and True and false as being equal then that would do it, but changing only what VTFT on it's own doesn't resolve the issue.
If VTHTControl.Active = True then ...
or
BooleanVar := VTHTControl.Active;
I guess if you are changing the compiler to accept both 1/0 and True and false as being equal then that would do it, but changing only what VTFT on it's own doesn't resolve the issue.
JohnB
MikroPascal for PIC18 and DsPIC, Visual TFT
MikroPascal for PIC18 and DsPIC, Visual TFT
Re: CheckBox problem
I too can not get the vTFT checkbox object working properly. This does not toggle the tick sign. I would expect the approach below to be independent of bit or byte Boolean?
void S2_ChkBox_TPOnClick()
{
S2_ChkBox_TP.Checked = !S2_ChkBox_TP.Checked;
DrawCheckBox(&S2_ChkBox_TP);
// if(S2_ChkBox_TP.Checked)
// TP_Calibrate();
}
void S2_ChkBox_TPOnClick()
{
S2_ChkBox_TP.Checked = !S2_ChkBox_TP.Checked;
DrawCheckBox(&S2_ChkBox_TP);
// if(S2_ChkBox_TP.Checked)
// TP_Calibrate();
}
Re: CheckBox problem
This is an old issues and one which has been raised with mE previously.
There are many inconsistencies both within VTFT and between VTFT and the compilers.
e.g. colour values and color names.
There are many inconsistencies both within VTFT and between VTFT and the compilers.
e.g. colour values and color names.
JohnB
MikroPascal for PIC18 and DsPIC, Visual TFT
MikroPascal for PIC18 and DsPIC, Visual TFT