Please forgive this script Les, its very crude and really doesn't do very much, it was just the start of an ini editor. i know your probably looking to build something different, designed more around your specific application, but its a head start for yeah:
code:
break on
$filename = "@curdir\iniedit.ini"
$form = createobject("kixtart.form")
$form.caption = "IniEditor"
$form.width = 640
$form.height = 480
$form.fontname = "verdana"
$form.fontsize = 10
$file = $form.menu("File")
$open = $file.menubutton("Open...","open_click")
$exit = $file.menubutton("Exit","exit_click")
$edit = $form.menu("Edit")
$new = $edit.menu("New")
$newkey = $new.menubutton("Key...","newkey_click")
$newvalue = $new.menubutton("Value...","tkpickcolor()")
$format = $form.menu("Format")
$font = $format.menu("Font")
$fontsml = $font.menubutton("Small","$$list.fontsize=8 $$view.fontsize=8")
$fontmed = $font.menubutton("Medium","$$list.fontsize=12 $$view.fontsize=12")
$fontbig = $font.menubutton("Large","$$list.fontsize=16 $$view.fontsize=16")
$list = $form.listbox
$list.height = $form.scaleheight-50
$list.width = $form.scalewidth/3
$list.onclick = "list_click"
$view = $form.listbox
$view.left = $list.right
$view.height = $form.scaleheight-50
$view.width = $form.scalewidth-$list.width
$view.onclick = "view_click"
$form.scaleheight = $list.bottom+10
$form.show
while $form.visible
$=execute($form.doevents)
loop
exit 1
function list_click
$section = $list.text
$view.clear
for each $key in split(readprofilestring($filename,"$section",""),chr(10))
if $key
$value = readprofilestring($filename,"$section","$key")
$string = $key + " = " + $value
$view.additem($string)
endif
next
endfunction
function view_click
; $list.listindex = -1
?"value=" $view.text
endfunction
function newkey_click
$key = $form.inputbox("Enter a name for the new key:","New Key")
if $key
$list.additem($key)
endif
endfunction
function open_click
$filename = $form.showfileopen("%windir%\*.ini")
if exist($filename)
$list.clear
$view.clear
for each $section in split(readprofilestring($filename,"",""),chr(10))
if $section
$list.additem($section)
endif
next
$list.listindex = 0
$section = $list.text
for each $key in split(readprofilestring($filename,"$section",""),chr(10))
if $key
$value = readprofilestring($filename,"$section","$key")
$string = $key + "=" + $value
$view.additem($string)
endif
next
endif
endfunction
function exit_click
quit()
endfunction
function font_click
$size = tkinputbox("Enter the font size","Font...")
if @error = 0 and $size
$view.fontsize = $size
$list.fontsize = $size
endif
endfunction
-Shawn
p.s. Im still developing the inputbox method of the form object (see newkey_click) - it's not done yet - it displays the box but doesn't return the string (yet). If you need an Kixforms inputbox function, there a couple floating around on the board here. I'll dig it up...
-Shawn
[ 24 May 2002, 04:40: Message edited by: Shawn ]