×
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

Change via Window

Change via Window

Change via Window

(OP)
First of all, hello, I just started to use Clarion 6.3. so I'm not very good at it. I just want to know how to make a Window act like a Update Form, specificaly a Change. Thx.

RE: Change via Window

Hi!

To make a Window procedure act as a Update Form, use the Control Template "Save Button" which will add a OK Button to the Window. Add the Table to be saved in the File Schematic & fill out the template prompts. How is this window going to be called - from a Browse or elsewhere? Why? Because in a Browse-Form paradigm it is always the Browse which fetches the record/row for Change/Delete & prime the columns for an Insert. So, if you are calling the Window procedure from somewhere else make sure that ::
1) Retrieve the Record/Row for a Change/Delete and Clear the Record for an Insert
2) Set the GlobalRequest = InsertRecord OR ChangeRecord OR DeleteRecord before calling the Window procedure

Example ::

CODE

CLEAR(FIL:Record)
GlobalRequest = InsertRecord
MyWindowProcedure
IF GlobalResponse = RequestCompleted
   !row added
ELSE
END

CLEAR(FIL:Record)
FIL:ID = 11
GET(MyFile, MyPrimaryKey)
GlobalRequest = ChangeRecord
MyWindowProcedure
IF GlobalResponse = RequestCompleted
   !row changed
ELSE
END

Regards

RE: Change via Window

(OP)
The window is called from a Menubar Item actually. It is a design choice that i rather not change. I did what you said and I got an error:" Adding this record creates a duplicate entry for the key. Primary key."

 

RE: Change via Window

Hi!

Since you want to open the form in Change mode only, could you tell me the name of the Table & it's primary key? Is it a SINGLE row table? Are you using the Legacy or ABC template chain in your application?

Regards
 

RE: Change via Window

(OP)
TABLE:      USER_PROFILE
PK:         K_USER
ATTRIBUTES: NAME
            PASSWORD

I'm using the ABC template chain.

RE: Change via Window

Hi!

Since this is the User Table, I am assuming that there must be multiple rows. So, which row is he supposed to CHANGE when clicks on the Menu Item? What is the purpose of this Menu option - to change password, etc.?

Assuming you want to change the logged in User's profile and the logged in User is stored in GLO:User, the code to be executed BEFORE the procedure is called (you will have to go into Embeds -> Source and find the correct embed in the Frame procedure) would be ::

CODE

CLEAR(USR:Record)
USR:Name = GLO:User
GET(USER_PROFILE, USR:K_USER)
IF ERRORCODE()
   !... handle error ...
   SELECT(?MenuItem) ; CYCLE
ELSE
   GlobalRequest = ChangeRecord
END

Regards

 

RE: Change via Window

(OP)
The purpose is to let the user change the name or password of the created profile.

RE: Change via Window

Hi!

Does "created profile" mean their profile? If so, the code I gave should be fine.

Regards
 

RE: Change via Window

(OP)
Thank you VERY MUCH!

RE: Change via Window

Hi!

Does that mean it works?

An alternative approach is to code it in the Window procedure itself, thereby allowing the Window procedure to be called in its own thread from the Frame.

At WindowManager.Init - After Opening Files embed - add the following code ::

CODE

CLEAR(USR:Record)
USR:Name = GLO:User
IF Access:USER_PROFILE.Fetch(USR:K_USER)
   !... handle error ...
   RETURN LEVEL:Fatal
ELSE
   SELF.Request         = ChangeRecord
   SELF.OriginalRequest = ChangeRecord
END

Regards
 

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