Ask Dr. DePhobia - Questions and Answers about Clarion

by Jim DeFabia

Published 1999-01-01    Printer-friendly version

Q:

How can I change the background color in the Embeditor? The black on gray is making me go blind.

A:

You could stop using the Embeditor when you need glasses, or you can change the Embeditor's color options. You can do this in one of two ways--through the IDE or by editing the editor's INI file. Editing the INI file allows you to choose more colors, but the colors available from the IDE's color choice dialog should be enough.

To change the color from the IDE:

  1. Choose Setup -> Editor Options.
  2. Select the Colors tab.
  3. Select Disabled Background in the list.
  4. Mark the Custom button, then click on the color you want from the choices displayed.
  5. Press the OK button.

To change the color by editing the INI file:

  1. With Clarion closed, open the INI file in a text editor (e.g., Notepad).
  2. Find the [color_groups] section and locate the value for Disabled Background.
  3. Locate the [color_map] section and modify the RGB (Red, Green, Blue) value for the number which corresponds with the Disabled Background.
  4. Save the INI file and close it.

When you restart Clarion the editor uses the color you specified.

Q:

I want to add an animated GIF to my application's toolbar that works like NetScape's or Internet Explorer's. I want the image to move when a process is working and stop when there is no activity. Does an IMAGE control have a property I can set to make it stop?

A:

Nope, but they aren't setting a property to stop the animation in the programs you've seen either. If it were to merely stop animation at the time activity ceases, you would see the animation freeze at a random position. In other words, you would see it frozen at different frames within the animation sequence. What they are doing behind the scenes is changing the image's source.

Here is an example:

If ActivityHapening !Flag
  ?Image1{Prop:Text} = '~spinning.gif'
ELSE
  ?Image1{Prop:Text} = '~stopspin.gif'
END

Now since you want this on the application's frame, you will need to setup some user-defined events and set the IMAGE's graphic based on these events. The procedures that you want to be able to change this image will post the appropriate events to the frame at appropriate times.

Let's walk through the steps:

First, you have to set up a means of communicating with the frame procedure from the child procedure. This involves three parts:

  1. Store the frame's thread number so you know which thread you will get the message.
  2. Create user-defined events for the frame. You'll change the IMAGE's source file based on these events.
  3. Send the events to the frame using POST to tell the frame to change the IMAGE's source.

Next, define a global variable (Press the Global Properties button, then press the Data button). Call this GLO:MainThreadNo and make it a BYTE.

data.gif

Next, declare two new event EQUATEs in the Global Properties, Global Data embed point:

EVENT:StartActivity EQUATE(401h)
EVENT:StopActivity EQUATE(402h)

(Note: user-defined events must start after 400h.)

Next in the Frame procedure, find the Local Objects, ThisWindow (WindowManager), Init procedure, CODE, Initialize the procedure embed point [Priority 6,001]. Insert the following code:

GLO:MainThreadNo = THREAD()

This stores the frame's thread number in the global variable. Whenever an MDI procedure is STARTed, a thread number is allocated to it. We need the thread number in order to post a message to the frame procedure.

init.gif

Now, still in the frame procedure, find the Local Objects, ThisWindow (WindowManager), TakeWindowEvent procedure, CODE, CASE EVENT() embed point [Priority 7,550]. Insert the code to handle the two user-defined events that the frame procedure will receive. This embed point places the code inside the CASE structure which handles events.

OF EVENT: StartActivity
  ?Image1{Prop:Text} = '~spinning.gif'
OF EVENT: StopActivity
  ?Image1{Prop:Text} = '~stopspin.gif'

Now to start or stop the animation from another procedure, embed the following code at the point where you want to control the animation (e.g., the Window events--OpenWindow and CloseWindow):

POST(EVENT:StartActivity,,GLO:MainThreadNo)

or

POST(EVENT:StopActivity,,GLO:MainThreadNo)

Note that the second parameter is omitted ("comma comma").

That's all there is to it. Now your application will provide the feedback your users want.

Q:

I. am using "latched" radio buttons (RADIO button controls with an ICON specified). This shows one depressed at any one time. Pressing another, raises the one formerly depressed. I want to be able "clear" them all so none appear depressed. Can you help?

A:

My RADIO buttons have occasionally suffered from depression, too. And Prozac does not help.

What I did was consult my favorite medical reference--The Language Reference! This contains the prescription we need to raise those buttons. Quoting from the LR:

"No RADIO button selected is a valid option, which occurs only when the OPTION structure's USE variable does not contain a value related to one of its component RADIO controls. This condition only lasts until the user has selected one of the RADIOs."

In other words, if the OPTION's USE variable is set to a value that is not a value of a RADIO choice, then all RADIO buttons appear raised. You set this value at the appropriate point in the code where you want to "reset" the buttons.

Printer-friendly version

Reader Comments

To add a comment to this article you must log in.

 
 

Search

 

Advanced Search
Topical Index

Related Articles

Subscribe to
ClarionMag

One year: $169

(includes all back issues since '99)

Renewals from $119

Two years: $269

Renewals from $219

More Info

Subscribe Now!

ClarionMag Blog

RSS Feeds

Updates via Email

Enter your Email


Powered by FeedBlitz

Quick Links