Sign in to follow this  
Followers 0
Tasmania

Check and Uncheck of a menu item evaluating incorrectly upon opening of data

10 posts in this topic

#1 ·  Posted (edited)

Upon first display of this form, BicNotes is not checked - correct.

Upon continuation of first display BicNotes is false - correct.

Upon clicking back to redisplay form and correct an issue, BicNotes is still unchecked - correct.

Upon clicking continue to redisplay the confirmation form, BicNotes is still false - correct.

Exit button works on both forms - correct.

Restart displays a new, fresh form - correct.

Saving an item and going through these steps all evaluate correctly - correct.

Revewing the item variables inside of the saved *.sla file and bearing true values - correct.

Opening a saved *.sla file presents correct and accurate data - almost.

If you run the application and save a blank file, you will see that, under Secondary Information, BICNotes is false.

[sECONDARY INFORMATION]

QTY=1

BICNotes=False

ExNotes=N/A

This is accurate with the data that we just saved through the application.

Now, if you close out of the application and restart it, and open the same file that we just saved, you will find that if you navigate to the Edit menu, Add BIC Notes will be checked, however in the file that you just opened, it's saved as False. Upon further investigation, your console will read:

>"C:\Documents and Settings\USPJEFE\Desktop\Projects\autoit-v3\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\USPJEFE\Desktop\Projects\2.0\SLA-2.0.au3"

Upon open: bicnotes = False

This will only appear once you attempt to "Open" the file, and the value stored in the console is the value of $bicnotes, which is what the variable has it's name as. If you click on the "Add Bic Notes" checked item in the menu, you will find that the console will output:

Before selection: bicnotes = False

After selection: bicnotes = False

Which is an indication that the value is not being taken advantage of by the Not found on line 163 in SLA-2.0.au3. I do not know why this is the case, however it is not inverting the values... like it should. If you continue on, and you attempt to recheck Add Bic Notes, the console will output:

Before selection: bicnotes = False

After selection: bicnotes = True

And work as expected. I will include small parts of the code as well as uploading the necessary script parts. Please note, there are a total of four files for this script, however I will only post two as that is what is needed for this error to occur, so you will need to comment out some includes located near the begenning of the script.

Code:

Lines 160-171 SLA-2.0.au3 - Selecting the menu item Add Bic Notes

Case $mnuBicNotes ; if you selected the bic notes
   ConsoleWrite(@CRLF & "Before selection: bicnotes = " & $bicnotes)
   
   $bicnotes = Not $bicnotes
   
   If $bicnotes Then 
    GUICtrlSetState($mnuBicNotes, $GUI_CHECKED)
   Else
    GUICtrlSetState($mnuBicNotes, $GUI_UNCHECKED)
   EndIf
   
   ConsoleWrite(@CRLF & "After selection: bicnotes = " & $bicnotes)

Thanks for the help (by the way, this is my new format for asking for help, let me know what you think)!

Edited by Tasmania

Share this post


Link to post
Share on other sites



Nobody knows?

Share this post


Link to post
Share on other sites

Ok, so I've done a little bit more to error output and I'm even more confused now.

I added this to the code at line 155 (displaying 154-169):

Case $mnuBicNotes ; if you selected add bic notes
            ConsoleWrite(@CRLF & "Before inverse: bicnotes = " & $bicnotes)
            
            $bicnotes = Not $bicnotes
            
            ConsoleWrite(@CRLF & "After the inverse: bicnotes = " & $bicnotes)
            
            If $bicnotes Then 
                GUICtrlSetState($mnuBicNotes, $GUI_CHECKED)
                ConsoleWrite(@CRLF & "Upon Selecting Add Bic Notes: bicnotes evaluated to true")
            Else
                GUICtrlSetState($mnuBicNotes, $GUI_UNCHECKED)
                ConsoleWrite(@CRLF & "Upon Selecting Add Bic Notes: bicnotes evaluated to false")
            EndIf
            
            ConsoleWrite(@CRLF & "After selection: bicnotes = " & $bicnotes)

The resulting output is:

Upon open: bicnotes = False

Before inverse: bicnotes = False

After the inverse: bicnotes = False

Upon Selecting Add Bic Notes: bicnotes evaluated to false

After selection: bicnotes = False

Share this post


Link to post
Share on other sites

I'm slightly dismayed by this output. If you save a file with Add Bic Notes as true and then run the application, you recieve the following:

Upon open: bicnotes = True

Before inverse: bicnotes = True

After the inverse: bicnotes = False

Upon Selecting Add Bic Notes: bicnotes evaluated to false

After selection: bicnotes = False

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

"False" in the ini is a String, when you want to NOT the VAriable you have to make sure its a Numeric variable ...not a string.

try this to see if that explains it:

$test = "False"
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I understand that... as it makes sense, however with a numeric value it's still evaluating incorrectly. Current output:

Upon open: bicnotes = 0

Before inverse: bicnotes = 0

After the inverse: bicnotes = False

Upon Selecting Add Bic Notes: bicnotes evaluated to false

After selection: bicnotes = False

Current Code:

; (Begenning of ap)
Global $bicnotes = 0

; Line 154-169
Case $mnuBicNotes ; if you selected add bic notes
            ConsoleWrite(@CRLF & "Before inverse: bicnotes = " & $bicnotes)
            
            $bicnotes = Not $bicnotes
            
            ConsoleWrite(@CRLF & "After the inverse: bicnotes = " & $bicnotes)
            
            If $bicnotes Then 
                GUICtrlSetState($mnuBicNotes, $GUI_CHECKED)
                ConsoleWrite(@CRLF & "Upon Selecting Add Bic Notes: bicnotes evaluated to true")
            Else
                GUICtrlSetState($mnuBicNotes, $GUI_UNCHECKED)
                ConsoleWrite(@CRLF & "Upon Selecting Add Bic Notes: bicnotes evaluated to false")
            EndIf
                    
            ConsoleWrite(@CRLF & "After selection: bicnotes = " & $bicnotes)

Edit: For some reason, it was still storing 0 as a string... this was an odd one for me. Thanks Jos. I typecasted the variable upon open to Number and it worked fine.

Edited by Tasmania

Share this post


Link to post
Share on other sites

I understand that... as it makes sense, however with a numeric value it's still evaluating incorrectly. Current output:

Have you made the read info from the INI Numeric first ?

like:

$test = Number(IniRead("test.ini", "SECONDARY INFORMATION", "BICNotes", "0"))
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Just did that, thanks... it worked! :)

Share this post


Link to post
Share on other sites

Alternative is to save the True/False status and do it like this:

$test = (IniRead("test.ini", "SECONDARY INFORMATION", "BICNotes", "true") = "True")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
$test = Not $test
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
IniWrite("test.ini", "SECONDARY INFORMATION", "BICNotes", $test)

Enjoy :)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank you very much :)

I really appreciate you taking a moment to look at this for me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0