?
Solved

Saving/Loading TColor - Ini's and Strings.

Posted on 2000-05-05
7
Medium Priority
?
256 Views
Last Modified: 2010-04-04
In my app's preferences/display section, I'm trying to save colors for different kinds of text that will be added to my richedit.

I'm using a standard colordialog, and all I want is to select the color, stick it in a string, save the string to an ini file, and when the app is loaded, I need to load the string from the ini and apply it to RichEdit1.Selattributes.Color

I've tried just using IntToStr on the colors and StrToInto when applying them back to selattributes, but it's not working!

Anyone?

-Psylord
0
Comment
Question by:Psylord
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:Psylord
ID: 2782800
Adjusted points from 0 to 10
0
 
LVL 15

Expert Comment

by:simonet
ID: 2783213

Typecast the TColor variable to Longint and then call IntToStr.

Alex
0
 
LVL 1

Expert Comment

by:rowisoft
ID: 2783659
Hy!

I've found this in one of my programms...
Look:

     if TEdit(Sender).Color = clAqua then Form2.Edit12.Text := 'Aqua' else
     if TEdit(Sender).Color = clBlack then Form2.Edit12.Text := 'Black' else
     if TEdit(Sender).Color = clBlue then Form2.Edit12.Text := 'Blue' else
     if TEdit(Sender).Color = clDkGray then Form2.Edit12.Text := 'DkGray' else
     if TEdit(Sender).Color = clGreen then Form2.Edit12.Text := 'Green' else
     if TEdit(Sender).Color = clLime then Form2.Edit12.Text := 'Lime' else
     if TEdit(Sender).Color = clLtGray then Form2.Edit12.Text := 'LtGray' else
     if TEdit(Sender).Color = clMaroon then Form2.Edit12.Text := 'Maroon' else
     if TEdit(Sender).Color = clNavy then Form2.Edit12.Text := 'Navy' else
     if TEdit(Sender).Color = clOlive then Form2.Edit12.Text := 'Olive' else
     if TEdit(Sender).Color = clPurple then Form2.Edit12.Text := 'Purple' else
     if TEdit(Sender).Color = clRed then Form2.Edit12.Text := 'Red' else
     if TEdit(Sender).Color = clSilver then Form2.Edit12.Text := 'Silver' else
     if TEdit(Sender).Color = clTeal then Form2.Edit12.Text := 'Teal' else
     if TEdit(Sender).Color = clWhite then Form2.Edit12.Text := 'White' else
     if TEdit(Sender).Color = clYellow then Form2.Edit12.Text := 'Yellow' else
     if TEdit(Sender).Color = clActiveCaption then Form2.Edit12.Text := 'ActiveCaption' else
     if TEdit(Sender).Color = clBackground then Form2.Edit12.Text := 'Background' else
     if TEdit(Sender).Color = clInActiveCaption then Form2.Edit12.Text := 'InActiveCaption' else
     if TEdit(Sender).Color = clMenu then Form2.Edit12.Text := 'Menu' else
     if TEdit(Sender).Color = clWindow then Form2.Edit12.Text := 'Window' else
     if TEdit(Sender).Color = clMenuText then Form2.Edit12.Text := 'MenuText' else
     if TEdit(Sender).Color = clWindowText then Form2.Edit12.Text := 'WindowText' else
     if TEdit(Sender).Color = clCaptionText then Form2.Edit12.Text := 'CaptionText' else
     if TEdit(Sender).Color = clActiveBorder then Form2.Edit12.Text := 'ActiveBorder' else
     if TEdit(Sender).Color = clInActiveBorder then Form2.Edit12.Text := 'InActiveBorder' else
     if TEdit(Sender).Color = clAppWorkSpace then Form2.Edit12.Text := 'AppWorkSpace' else
     if TEdit(Sender).Color = clHighlight then Form2.Edit12.Text := 'Highlight' else
     if TEdit(Sender).Color = clHighlightText then Form2.Edit12.Text := 'HightlightText' else
     if TEdit(Sender).Color = clBtnFace then Form2.Edit12.Text := 'BtnFace' else
     if TEdit(Sender).Color = clBtnShadow then Form2.Edit12.Text := 'BtnShadow' else
     if TEdit(Sender).Color = clGrayText then Form2.Edit12.Text := 'GrayText' else
     if TEdit(Sender).Color = clBtnText then Form2.Edit12.Text := 'BtnText'else
     if TEdit(Sender).Color = clInactiveCaptionText then Form2.Edit12.Text := 'InActiveCaptionText' else
     if TEdit(Sender).Color = clBtnHighlight then Form2.Edit12.Text := 'BtnHighlight' else
     if TEdit(Sender).Color = cl3DDkShadow then Form2.Edit12.Text := '3DDKShadow'else
     if TEdit(Sender).Color = cl3DLight then Form2.Edit12.Text := '3DLight'else
     if TEdit(Sender).Color = clInfoText then Form2.Edit12.Text := 'InfoText' else
     if TEdit(Sender).Color = clInfobk then Form2.Edit12.Text := 'Infobk' else
     Form2.Edit12.Text := inttostr(integer(TEdit(Sender).Color));
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Psylord
ID: 2783668
Thanks... but I've figured it out on my own.
0
 
LVL 1

Accepted Solution

by:
rowisoft earned 40 total points
ID: 2783675
Hy!

Good!!
And nobody gets the points???

Robert Wismet
0
 

Author Comment

by:Psylord
ID: 2783682
Since I'm a nice guy.

-Psylord
0
 
LVL 15

Expert Comment

by:simonet
ID: 2784171
What's going on here?

Robert's suggestion can be made **A LOT** faster:

1) by using CASE statements
2) by dropping all testing statements and using ColorToIdent

Alex
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question