Re: Any way to use custom colors for text that are not in color table?


Tim Downie
 

The colorset stuff works well be have a color builder in one of our applications at the user level.
Just be aware the colorset doesnt work on GUI output forms to a PDF - (at least in v3x.x anyway)


From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Keith Canniff <kcanniff@...>
Sent: Thursday, 19 May 2022 4:26 AM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: Re: [magicu-l] Any way to use custom colors for text that are not in color table?
 

Fredrick,

 

There are several ways to manage what you’re asking for

 

  1. Using the ColorSet and FontSet functions, you can dynamically change colors in the currently defined (in the INI file) color table (default clr_std.eng <replacing .eng with your language>). And yes the color number will have to exist in the color table. Note: The change is only for the duration of your session since the change does not change the actual file. See Magic’s help on these two functions
  2. Create different color tables to allow you easily setup multiple “themes” for your application. In other words you can have a clr_light.eng, clr_dark.eng, clr_coastal.eng, etc. Each of these have been setup with different colors to allow your application to take on entirely different looks. Then you could have something like in a user profile table a drop down that allows the user to pick Light, Dark, Coastal for the theme and you do an INIPUT to update an INI Logical Name. Something like “MyAppColorTheme” and “MyAppFontTheme”. Last, in your application in the studio, go to File/Application Properties and click on the “External Files” tab. Here you can set the ”Applicatoin Color Definition file” to “%MyAppColorTheme%” and the “Application Font Definition file” to “%MyAppFontThem%”. When the user logs into your application, in Main Program call a program that reads the user profile, gets the them value and does the INIPUT to change the font and color to what the user selected and now your application can be customized to different user’s preferences.

 

Beyond the above, Steve outlines a great way to do more control based colors and fonts in the data itself.

 

Keith

 

From: main@magicu-l.groups.io <main@magicu-l.groups.io> On Behalf Of Steven Blank
Sent: Wednesday, May 18, 2022 1:47 PM
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] Any way to use custom colors for text that are not in color table?

 

Adrian,

Regarding the font FG and BG colors of relevant Magic controls, the colors must be defined in the color table. If you've placed a .NET control on your form, then FG and BG colors can be set in the control by modifying the appropriate property and DNSet() expressions.

The one control, well, two controls actually, wherein you CAN specify colors not defined in the color table would be the Rich Text and Rich Edit controls. If you're unfamiliar with the concept of rich text, it could be thought of as the precursor to HTML, in that various formatting commands can be embedded within the text using tokens.

To reverse engineer a block of rich text, create a small document using Microsoft Word Pad and save it as a Rich Text (*.rtf) document. Then you can peek under the sheets using your favorite text editor, like Notepad, Notepad++, Ultra-Edit, or somesuch.

To see an example of rich text at runtime, execute DDF Maker from your Studio's Tools menu. On the "Welcome" window, click on the hyperlink "Contributed by Steven G. Blank" to open the "About" window. The area you see bounded in red below is a Magic Rich Text control:

Steven G. Blank
Ξ SGBlank Consulting

On 5/17/2022 10:11 PM, Adrian Wick wrote:

Hello all,

is it possible to use hval function in some way for font color? If it is possible, how do you combine than the foreground and the background colors?
Or there is no other way and ill have to add it to color table?

Regards
A

 

Join main@magicu-l.groups.io to automatically receive all group messages.