Jump to content

INI files and Xcontrols


Recommended Posts

I really underestimated the popularity of using an xcontrol for configuration files. So by popular demand, here is the prototype. The ini file format is as follows:

[tag] #use the parameters tag to reference it in code

description= #this text will appear in the caption below the tree control when this parameter is selected

section= #the parent of this parameter in the tree control

label= #what the user sees in the tree control

default= #obvious i hope

type= #one of STRING|COMBO|BOOLEAN|INTEGER|DOUBLE

selections= #applies only to combo boxes... separate items with a pipe (|)... add an * item to allow undefined strings (buggy)

format= #applies only to double, is the format string of the numeric display

minimum= #applies only to numeric types (integer, double)

maximum= #applies only to numeric types (integer, double)

Download File:post-478-1133280396.zip

Link to comment

From info-labview:

I have historically used NIs ini palette because it was there and the users do seem to like the ini format. One problem has been the initial code investment... I sometimes get bogged down coding configuration panels. Then NI gave us the x control and the first thing I thought of was abstracting the configuration code. So I have made an x control that looks like a tree control and has all the code to read an ini file and let the user change the parameters. It has two methods... "load ini" and "get parameter".

If anyone is interested I'd love to share the code with you and hopefully make it better.

George

Link to comment

Right... the control does not write to the INI file right now. One of the methods I was working on when I posted was "make current values default" which would rewrite the default values in the ini file with the current values in the control.

What really makes this a prototype though are the UI quirks... there are several things you can do to get the control in a confusing UI state and the yellow faux tool tips that appear over the value or label in the tree control have confused the people that have tested this for me. Also, you might notice I hid the tree controls scroll bar and then added a scroll bar to the xcontrol... this is because the mouse wheel can scroll the tree control but does not trigger any LV event so its not possible for me to move the visible editor... and then things get inconsistent and confusing.

An event that would have made coding this MUCH simpler is a "lost focus" event... but currently no such thing exists.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.