![]() |
|
Published 1998-01-01 Printer-friendly version
I like the new wallpaper feature in Clarion 4, especially the ability to add wallpaper to the client area of an Application Frame. There are times, however, when I don't want an image in the frame's client area but want to specify a color. Can this feature be added in the future?
Why wait for the future? I can help you in the present. You can "colorize" the client area of a frame by merely adding a single color graphic as the Frame's wallpaper and using the STRETCHED attribute to fill the client area with the image.
I like the new Flat buttons in Clarion 4, but I want to use them for buttons without an icon. Is this possible?
Yes. To utilize the FLAT attribute, you must specify an ICON attribute. This attribute can, however, be a blank icon or use the EQUATE--ICON:None. In other words, you can have a text button which supports the extended features. These features include colorization of fonts and the FLAT attribute.
If you specify No Icon in the Window Formatter, the generated code omits the ICON attribute. To add the ICON:None equate to the ICON attribute, you must edit the WINDOW structure as source using the ellipsis (...) button from the Procedure Properties window. Locate the BUTTON declaration and add ICON(ICON:None) to the declaration.
Speaking of the new FLAT attribute on a BUTTON, there is one other trick you can use to spruce up your applications. If you use a GIF for the ICON, you get an image that is gray-scaled when inactive and in full living color when activated by hovering the mouse over it. In addition, if you use an animated GIF as the ICON for a button, you get animation only when the mouse is over the button. Using this technique, you can make your buttons really come alive when the mouse awakens them!
I have an application that needs two different ways to update records in a Browse Box. For simple edits, Edit-in-Place will suffice. For adds and more detailed updates, I need an Update Form. Is there an easy way to accomplish this?
Yes, it's as simple as A-B-C, now that we have the ABC templates.
Seriously, this was something that was frequently needed, but wasn't really easy to do -until now! The technique I will explain shows one of the reasons the Application Builder Class Templates are so "kewl."
First, let's examine what a Browse Procedure does when the user calls for an update. It calls a method named something like BRW1.ThisWindow.Run. The method takes a number as a parameter. This number is the value of the BRW1.AskProcedure property.
In other words, if you enable Edit-In-Place and specify an update procedure, you have two-thirds of your work done. Set the BRW1.AskProcedure Property to 0 (zero) and you have Edit-in-Place; Set it to 1 (One) and you call your update procedure.
Let's make this change in a small application. For purposes of this exercise, we'll use the example - People.APP in the Clarion4\Examples\Reports directory. Before we begin, let's rename it to People2.APP. Open the application and follow the steps below.
Let's walk through the steps:
BRW1:AskProcedure = 1
IF RECORDS(SELF.ListQueue) AND KEYCODE() = MouseLeft2 BRW1.AskProcedure=0 END

BRW1.AskProcedure = 1This is important. It ensures the value is the same as when you started. I like to think of this type of code as "If you turn the light on when you enter a room, be sure to turn it off when you leave."
More fun with the AskProcedure property
That gives us two alternatives. However, the ABC templates allow us to add more possibilities easily. We know that the AskProcedure property can have a value of 0 or 1. What if we want more possibilities?
Let's look at the second ThisWindow.Run PROCEDURE (the one with two parameters). Notice it takes a USHORT parameter named Number and a BYTE named Request). The number parameter it receives is the value of the AskProcedure. With this knowledge, we can add a third "update" procedure-this one a record viewer instead of a record update procedure.
Let's examine the code:
ThisWindow.Run PROCEDURE(USHORT Number,BYTE Request) ReturnValue BYTE,AUTO ! Start of "WindowManager Method Data Section" ! [Priority 5000] ! End of "WindowManager Method Data Section" CODE ! Start of "WindowManager Method Executable Code Section" ! [Priority 2500] ReturnValue = PARENT.Run(Number,Request) ! [Priority 6000] GlobalRequest = Request Updatepeople ReturnValue = GlobalResponse ! [Priority 8500] ! End of "WindowManager Method Executable Code Section" RETURN ReturnValue
Now let's modify it so it looks like this:
ThisWindow.Run PROCEDURE(USHORT Number,BYTE Request)
ReturnValue BYTE,AUTO
! Start of "WindowManager Method Data Section"
! [Priority 5000]
! End of "WindowManager Method Data Section"
CODE
! Start of "WindowManager Method Executable Code Section"
! [Priority 2500]
ReturnValue = PARENT.Run(Number,Request)
! [Priority 6000]
GlobalRequest = Request
EXECUTE Number
Updatepeople
Viewpeople
END
ReturnValue = GlobalResponse
RETURN ReturnValue
!next 4 lines of code never execute
GlobalRequest = Request
Updatepeople
ReturnValue = GlobalResponse
! [Priority 8500]
! End of "WindowManager Method Executable Code Section"
RETURN ReturnValue
This now allows us to have an alternate update procedure! Using this technique, you can have as many possible update procedures as you want. You can imagine the possibilities:
This completed application is available for download. The application shows some additional buttons.
Copyright © 1999-2008 by CoveComm Inc. All Rights Reserved. Reproduction in any form without the express written consent of CoveComm Inc., except as described in the subscription agreement, is prohibited.
Clarion Magazine ISSN 1718-9942
One year: $189
(includes all back issues since '99)
Renewals from $139
Two years: $289
Renewals from $239