×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how to use clarion help examples?

how to use clarion help examples?

how to use clarion help examples?

(OP)
I face problem in trying the code in clarion 6.3 help
I see the code but dont know where to put it
for example these codes
!***code 1*******
 PROGRAM                         !Example program code

 MAP
OpenFile  PROCEDURE(FILE AnyFile)!Procedure prototype with parameter
ShoTime   PROCEDURE              !Procedure prototype without parameter
DayString PROCEDURE,STRING       !Procedure prototype with a return value
 END


FileOne FILE,DRIVER('Clarion')   !Declare a file

         RECORD                  !begin record declaration
Name      STRING(20)
Number    LONG
         END                     ! end record declaration
        END                      !End file declaration


TodayString STRING(9)
 CODE
 TodayString = DayString()      !Procedure called with a return value
 OpenFile(FileOne)              !Call procedure to open file
 ShoTime                        !Call ShoTime procedure
  !More executable statements

OpenFile PROCEDURE(FILE AnyFile)!Open any file

 CODE                           !Begin code section
 OPEN(AnyFile)                  !Open the file
 IF ERRORCODE() = 2             !If file not found
  CREATE(AnyFile)               !create it
 END   
 RETURN                         !Return to caller

ShoTime PROCEDURE               !Show time
Time  LONG                      !Local variable
Window WINDOW,CENTER
      STRING(@T3),USE(Time),AT(34,70)
      BUTTON('Exit'),AT(138,92),USE(?Exit)
    END
 CODE                           !Begin executable code section

 Time = CLOCK()                 !Get time from system
 OPEN(Window)
 ACCEPT
  CASE ACCEPTED()
  OF ?Exit
   BREAK
  END
 END
 RETURN                         !Return to caller

DayString   PROCEDURE           !Day string procedure
ReturnString STRING(9),AUTO     !Uninitialized local stack variable
 CODE                           !Begin executable code section
 EXECUTE (TODAY() % 7) + 1      !Find day of week from system date
  ReturnString = 'Sunday'

  ReturnString = 'Monday'
  ReturnString = 'Tuesday'
  ReturnString = 'Wednesday'
  ReturnString = 'Thursday'
  ReturnString = 'Friday'
  ReturnString = 'Saturday'
 END
 RETURN(ReturnString)           !Return the resulting string
!**********code2*****
Name       CSTRING(21)                         !Declare 21 byte field - 20 bytes data

OtherName  CSTRING(21),OVER(Name)              !Declare field over name field
Contact    CSTRING(21),DIM(4)                  !Array 21 byte fields - 80 bytes data
Company    CSTRING('SoftVelocity Corporation') !21 byte string - 20 bytes data
Phone      CSTRING(@P(###)###-####P)           !Declare 14 bytes - 13 bytes data
ExampleFile FILE,DRIVER('Btrieve')             !Declare a file
Record       RECORD
NameField     CSTRING(21),NAME('ZstringField') !Declare with external name

             END
            END
 CODE
 Name = 'Tammi'               !Assign a value
 Name[5] = 'y'                ! then change fifth letter
 Name[6] = 's'                ! then add a letter
 Name[7] = '<0>'              ! and handle null terminator
 Name[5:6] = 'ie'             ! and change a "slice"
                              !  -- the fifth and sixth letters
 Contact[1] = 'First'         !Assign value to first element
 Contact[1,2] = 'u'           !Change first element 2nd character

 Contact[1,2:3] = Name[5:6]   !Assign slice to slice
!*****end****************
please help

RE: how to use clarion help examples?

Hi!

Clarion programmers normally develop using the Application IDE which generates the required code. There are a lot of hand coders as well.

Help normally contain snippets of code which fit into the bigger context of the program. So, cutting & pasting from the help without knowing how a clarion program is structured will not work.
It is better to start with the "Getting Started" part of the help followed by the tutorials.

What are you actually trying to do and what version of Clarion are you using?

Regards
 

RE: how to use clarion help examples?

(OP)
Iam using 6.3
I have nothing special, just trying to learn more from help.
if you can tell me how to use the 2 examples I mentioned it will will be a good start for me.
thanx so much

 

RE: how to use clarion help examples?

Hi!

A working version of your test program is below. I am not sure what you are going to learn from this.

CODE

 PROGRAM                         !Example program code

 MAP
OpenFile   PROCEDURE(FILE AnyFile),BYTE !Procedure prototype with parameter
ShowTime   PROCEDURE              !Procedure prototype without parameter
DayString  PROCEDURE,STRING       !Procedure prototype with a return value
 END

FileOne   FILE,DRIVER('Topspeed'),NAME('FileOne.TPS'),PRE(FIL),CREATE  !Declare a file
Record      RECORD                 !begin record declaration
CurrDay       STRING(10)
CurrDate      DATE
CurrTime      TIME
            END                    ! end record declaration
          END                      !End file declaration

  CODE

  IF NOT OpenFile(FileOne) THEN RETURN.              !Call procedure to open file
  
  CLEAR(FIL:Record)
  FIL:CurrDay  = DayString()
  FIL:CurrDate = TODAY()
  FIL:CurrTime = CLOCK()
  
  ADD(FileOne)
  IF ERRORCODE()
     MESSAGE('Error # = ' & ERRORCODE() & '  Error Description = ' & ERROR(), 'E R R O R')
     RETURN
  END
  
  ShowTime()                        !Call ShowTime procedure
  
  RETURN
 
OpenFile PROCEDURE(FILE AnyFile)!Open any file

  CODE                           !Begin code section
  
  OPEN(AnyFile)                  !Open the file
  IF ERRORCODE() = 2             !If file not found
     CREATE(AnyFile)             !create it
     IF NOT ERRORCODE()
        OPEN(AnyFile)
     END
  END   
  IF ERRORCODE()
     MESSAGE('Error # = ' & ERRORCODE() & '  Error Description = ' & ERROR(), 'E R R O R')
     RETURN FALSE
  END   
  RETURN TRUE                         !Return to caller

ShowTime PROCEDURE               !Show time

Window WINDOW('Current Date/Day/Time'),AT(,,97,82),CENTER,FONT('Microsoft Sans Serif', 10,, FONT:regular, CHARSET:DEFAULT),DOUBLE
    STRING(@D3), AT(26,25), USE(FIL:CurrDate), CENTER
    STRING(@T3), AT(32,9), USE(FIL:CurrTime), CENTER
    STRING(@S10), AT(27,41), USE(FIL:CurrDay), CENTER
    BUTTON('Exit'), AT(32,60), USE(?Exit)
 END
 
 CODE                           !Begin executable code section

 OPEN(Window)
 ACCEPT
  CASE ACCEPTED()
  OF ?Exit
   BREAK
  END
 END
 CLOSE(Window)
 RETURN                         !Return to caller

DayString   PROCEDURE           !Day string procedure

ReturnString STRING(9),AUTO     !Uninitialized local stack variable

 CODE                           !Begin executable code section

 EXECUTE (TODAY() % 7) + 1      !Find day of week from system date
   ReturnString = 'Sunday'

   ReturnString = 'Monday'
   ReturnString = 'Tuesday'
   ReturnString = 'Wednesday'
   ReturnString = 'Thursday'
   ReturnString = 'Friday'
   ReturnString = 'Saturday'
 END
 
 RETURN(ReturnString)           !Return the resulting string

Regards
 

RE: how to use clarion help examples?

(OP)
That is my point , It is not the code itself but I dont know where to put the code and run it.
 
thank you for the follow up.


 

RE: how to use clarion help examples?

(OP)
I tried to take that code as an example:
I opened a new window procedure and put the data definations in the data section, created a button and put the code in it ... etc.
It took a lot of work to make it run. I am sure there is a direct way or a short cut to do it. but I couldnt find it, I tried to put the code as .clw file and call it but didnt work.

Please experts tell me how to do it right with many thanks.

RE: how to use clarion help examples?

Hi!

It is not possible to teach you Clarion over a newsgroup!

What version of Clarion are you using? Is it a legal copy i.e. not pirated. If it is a legal copy, you should have the help file & tutorials in it. Start with the help file - 1) Getting Started, 2) User Guide and Lessons & 3) Guide to all examples. The example applications will be in the <ClarionMainFolder>\Examples folder. Go through them one by one and whenever you want help with the Language, check out the Language Reference in the help.

On top of that, there is a paid training program from SoftVelocity (http://www.softvelocity.com/Training/Inside_Clarion7_IDE.html) which can be very useful to you.

Once you have done the above and you still want help, detail what you have done in clear steps so that I can understand it. Also, I use the Clarion 7 IDE and may not be able to help you in previous versions.

Regards
 

RE: how to use clarion help examples?

Hi!

Also, there are quite a few SWF videos in the <ClarionMainFolder\BIN\Flash folder which are called from the help but can also be called directly.

Regards
 

RE: how to use clarion help examples?

(OP)
Dear ShankarJ.
Iam so sorry for the whole confussion.
May be my way of asking was not correct, Iam a programmer and I have good knowledge in clarion, even I create templates some times.
My mistake from the begining that I took two dummy codes from the help to explain my idea and that was wrong.

what I need exactly is a way to take any example from the help (complecated ones)and paste it somewhere and make it run. the examples I gave are simple and any programmer can understand them, I know, I just pressed help button, coppied and pasted the first two examples I faced to explain my idea.

Iam using clarion 6.3 (Legal copy)
I hope you got my point
Many thanks again

RE: how to use clarion help examples?

Hi!

Well... the only place you can paste anything from the help is in the EMBEDS. But you will have to adapt the pasted text into the context of your application for it to work.

Regards
 

RE: how to use clarion help examples?

I expected that .. thank you for your patience ShankarJ
wish you best of luck
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close