TRegistry Problems!

ok thanks but now I have a problem am using a fontcombobox to select my font and I want it to add to the combo once it reads the font name how can I do this?

I done the code like this to try and get the itemindex but with no luck any idears???

[Write]
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
OpenKey('SoftwarefiveukCommunityTalk', True);
WriteInteger('FontName', FontBox1.ItemIndex);
WriteInteger('FontSize', SizeBox.ItemIndex);
WriteInteger('FontColor', ColorToRGB(JvColorButton1.Color));
finally
Free;
end;

[Read]
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
OpenKey('SoftwarefiveukCommunityTalk', False);
FontBox1.ItemIndex := ReadInteger('FontName');
SizeBox.ItemIndex := ReadInteger('FontSize');
JvColorButton1.Color := ReadInteger('FontColor');
finally
Free;
end;

I allso added on the OnChange of the combo

FFont:=Strtoint(FontBox1.Text);
SendMemo.Font.Name:= FontBox1.Items.Strings[FontBox1.ItemIndex];
Slewis

Comments

  • : ok thanks but now I have a problem am using a fontcombobox to select my font and I want it to add to the combo once it reads the font name how can I do this?
    :
    : I done the code like this to try and get the itemindex but with no luck any idears???
    :
    : [Write]
    : with TRegistry.Create do
    : try
    : RootKey := HKEY_CURRENT_USER;
    : OpenKey('SoftwarefiveukCommunityTalk', True);
    : WriteInteger('FontName', FontBox1.ItemIndex);
    : WriteInteger('FontSize', SizeBox.ItemIndex);
    : WriteInteger('FontColor', ColorToRGB(JvColorButton1.Color));
    : finally
    : Free;
    : end;
    :
    : [Read]
    : with TRegistry.Create do
    : try
    : RootKey := HKEY_CURRENT_USER;
    : OpenKey('SoftwarefiveukCommunityTalk', False);
    : FontBox1.ItemIndex := ReadInteger('FontName');
    : SizeBox.ItemIndex := ReadInteger('FontSize');
    : JvColorButton1.Color := ReadInteger('FontColor');
    : finally
    : Free;
    : end;
    :
    : I allso added on the OnChange of the combo
    :
    : FFont:=Strtoint(FontBox1.Text);
    : SendMemo.Font.Name:= FontBox1.Items.Strings[FontBox1.ItemIndex];
    : Slewis
    :
    Create is [b]not[/b] a function. You need to first declare a variable then, you can use
    [code]
    with varname do
    [/code]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion