Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Nov 19, 2017 7:01 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: code view help
PostPosted: Fri Apr 21, 2006 3:16 pm 
Offline

Joined: Thu Apr 13, 2006 3:17 pm
Posts: 41
Location: Milpits, CA
Hi, I am on my second week learning to use QF, so forgive me if this is an obvious question.



When in code view, I tried to change the value of the following assignment:

init tone := default

to one of the values in the list that appears on the right (any of them):

init tone := default_tone



However, when I compile, I receive : Error Status_toggle line 16: Parse error Unrecognized initialization value



What does that mean?



Thanks,

Ata

_________________
Semiconductor EFEM products


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 3:34 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
The item default_tone is actually a variable and not a constant. You can only initialize variables (using init) to constants not to other variables.



The default_tone and default_toneerror variables have another purpose. If you leave the objects tone and tone_error properties as default they end up using the the default_tone and default_toneerror variables values via the function that our standard objects call named _PlayTone. Here is the code for that function to understand how this works:

Code:

func _PlayTone (tone as _Note, duration as integer, err as boolean)

    if tone == Note_UseDefault then

        if err then

            if default_toneerror == Note_UseDefault then

                PlayNote (Note_High, duration)

            elseif default_toneerror <> Note_None then

                PlayNote(default_toneerror, duration)

            endif

        else

            if default_tone == Note_UseDefault then

                PlayNote(Note_Medium, duration)

            elseif default_tone <> Note_None then

                PlayNote(default_tone, duration)

            endif

        endif

    elseif tone <> Note_None then

        PlayNote (tone, duration)

    endif

endfunc





Having given a brief explanation of how default_tone and default_toneerror work let me show you how to create a couple constants you could initialize your tone variable to. Here is some code for example you can put in globals:

Code:

const my_def_tone := note_medium

const my_def_tone_error := note_high



Now you can use these constants to initialize tone and/or tone_error properties.

Code:

init tone := my_def_tone

init tone_error := my_def_tone_error





Of course your other option is to not change the objects tone or tone_error properties at all from defaults and change the default_tone and default_toneerror properties found in globals.

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 3:45 pm 
Offline

Joined: Thu Apr 13, 2006 3:17 pm
Posts: 41
Location: Milpits, CA
Thanks Ron,

leave it tome to pick the two items from the list I wasn't supposed to pick :oops: I did pick others from the list and they compiled fine. Thanks for the quick lesson.

Ata

_________________
Semiconductor EFEM products


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group