Solved

Saving/Loading TColor - Ini's and Strings.

Posted on 2000-05-05
7
253 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

Accepted Solution

by:
rowisoft earned 10 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
select query - oracle 16 101
Installshield for Embarcadero EX 10.1 Berlin 4 75
Slow Restore if incremental backups using RDiff.exe 4 39
Firemonkey BASS_Init into a thread 17 58
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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