Huub Peters wrote:
Steve Cookson wrote:


Hi People,

Does anyone know where I can find some example wxConfig code?


You need to set some values first. These are used to store the config values under.

  $self->SetAppName('YourAppName');
  $self->SetVendorName('YourVendorName');

Eg: under windows it creates these keys in the Registry under:
\\HKEY_CURRENT_USER\Software\YourVendorName\YourAppName\

  my $config = Wx::ConfigBase::Get;

  $config->Write('SomeName1', 'SomeValue1');
  $config->Write('SomeName2', 'SomeValue2');

And then somewhere else in your app:

  # In case you're in another namspace
  my $config = Wx::ConfigBase::Get;

  $config->Read('SomeName1');
  $config->Read('SomeUnsetName', 'DefaultValue');

Ehm, more usefull like this:
  my $val1 = $config->Read('SomeName1');
  my $val2 = $config->Read('SomeUnsetName', 'DefaultValue');

;-)


Hope it helps.

Cheers,
Huub Peters


Reply via email to