Hi Jeff,
That did the trick :-)
I had seen the defines for the various bases so when the function asked for
a base I just plugged BASE_DEC in. The old documentation did misslead me but
I could kick myself for not plugging in the obvious 10 !
Thanks for clearing that up.
Hal
From: Jeff Morriss <jeff.morriss@xxxxxxxxxxx>
Reply-To: Developer support list for Wireshark
<wireshark-dev@xxxxxxxxxxxxx>
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: Re: [Wireshark-dev] Problem with uint preference
Date: Wed, 31 Jan 2007 10:05:41 +0800
Hal Lander wrote:
> I registered a boolean preference and it worked.
> However, when I try and follow the same process with a uint it fails
> when I try and edit the preference and 'apply' the change. The message I
> get is;
>
> "The value for "xxxxxxTitle" isn't a valid number."
[...]
> The code I am using is given below, along with the edit I tried on
> preferences.
>
> Should I be editing the preferences file by hand to add in the variable.
No, there should never be any need to edit the preferences file by hand.
> Any ideas what I am doing wrong?
[...]
> static gboolean prefTick;
> static guint prefVer;
>
> prefTick=TRUE;
> prefVer=123;
>
>
prefs_register_bool_preference(foo_module,"tick","TickTitle","TickDescription",&prefTick);
>
prefs_register_uint_preference(foo_module,"xxxxxx","xxxxxxTitle","xxxxxxDescription",BASE_DEC,&prefVer);
The 'base' field in 'prefs_register_uint_preference()' is the base used
by 'strtoul()' when converting the string "123" into an unsigned
integer. Don't use BASE_DEC (whose value is 1) here but rather 0 or 10
if you want to input a decimal number.
I just checked in a change to README.developer to explain what this
parameter should be.
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev
_________________________________________________________________
FREE online classifieds from Windows Live Expo buy and sell with people
you know
http://clk.atdmt.com/MSN/go/msnnkwex0010000001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06