Sign in to follow this  
Followers 0
Floppy

Help with _GUICtrlListBox_AddString

5 posts in this topic

#include <GuiConstants.au3>
#Include <GuiListBox.au3>
#Include <File.au3>
AutoItSetOption("TrayMenuMode",1)

$links_gui=GUICreate("Links list",320,200)
$list=GUICtrlCreateList("",10,10,300,160)
$add=GUICtrlCreateButton("Add",10,170,60,20)
$edit=GUICtrlCreateButton("Edit",70,170,60,20)
$remove=GUICtrlCreateButton("Remove",130,170,60,20)
$go=GUICtrlCreateButton("Go",190,170,60,20)
$load=GUICtrlCreateButton("Load",250,170,60,20)

GUISetState(@SW_SHOW,$links_gui)

While 1
    $m=TrayGetMsg()
    $mm=GUIGetMsg()
    Select
Case $mm=$load
        $load_file=FileOpenDialog("Select a Links list file to load","","Links list files (*.pll)",3)
        $loaded_file=FileOpen($load_file,0)
        For $u=1 To _FileCountLines($load_file)
        $read_line=FileReadLine($loaded_file,$u)
        _GUICtrlListBox_AddString($list,$read_line)
        Next
                ...........
    EndSelect
WEnd

_GUICtrlListBox_AddString doesn't add nothing to $list. Why?

Share this post


Link to post
Share on other sites



FSoft,

Works perfectly for me when I run it with a .txt file. Are you sure you you are opening a valid .pll file and it has something in it? Perhaps a bit of error-checking would not go amiss.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

FSoft,

Works perfectly for me when I run it with a .txt file. Are you sure you you are opening a valid .pll file and it has something in it? Perhaps a bit of error-checking would not go amiss.

M23

You are right...with this script works...this is the FULL script...try now: NO ITEMS ARE ADDED IN THE LIST-BOX

#include <GuiConstants.au3>
#Include <GuiListBox.au3>
#Include <File.au3>
AutoItSetOption("TrayMenuMode",1)

$settings_gui=GUICreate("Settings",320,240)
GUICtrlCreateLabel("Language:",10,10,100,20)
$lang=GUICtrlCreateCombo("English",110,8,200,20)
$list_lang=_FileListToArray(@scriptdir&"\lang\","*.lang",1)
If Not @error Then
For $i=1 To UBound($list_lang) -1
$list_lang[$i]=StringReplace($list_lang[$i],".lang","")
GUICtrlSetData($lang,$list_lang[$i])
Next
Else
GUICtrlSetData($lang,"English","English")
EndIf

$run_with_windows=GUICtrlCreateCheckbox("Run automatically on Windows startup",10,30,300,20)
GUICtrlSetState($run_with_windows,$GUI_CHECKED)
$show_tray=GUICtrlCreateCheckbox("Show Tray Icon",10,50,300,20)
GUICtrlSetState($show_tray,$GUI_CHECKED)
$show_balloon=GUICtrlCreateCheckbox("Show Balloon Tips",10,70,300,20)
GUICtrlSetState($show_balloon,$GUI_CHECKED)
GUICtrlCreateGroup("<---Cancelled--->",10,95,300,75)

$before=GUICtrlCreateRadio("",15,115,20,20)
GUICtrlSetState($before,$GUI_CHECKED)
$before_days=GUICtrlCreateInput("10",35,115,45,20)
GUICtrlCreateUpdown($before_days)
GUICtrlCreateLabel("<---Cancelled--->",85,118,220,20)

$every=GUICtrlCreateRadio("",15,140,20,20)
GUICtrlCreateLabel("Every",35,142,50,20)
$every_days=GUICtrlCreateInput("90",65,140,45,20)
GUICtrlCreateUpdown($every_days)
GUICtrlCreateLabel("days",115,142,50,20)

GUICtrlCreateLabel("<---Cancelled---> Version:",10,177,100,20)
$version=GUICtrlCreateCombo("",110,175,200,20)
GUICtrlSetData($version,"<---Cancelled--->|<---Cancelled--->","<---Cancelled--->")

$ok=GUICtrlCreateButton("OK",10,210,150,20)
$cancel=GUICtrlCreateButton("Cancel",160,210,150,20)

$links_gui=GUICreate("Links list",320,200)
$list=GUICtrlCreateList("",10,10,300,160)
$add=GUICtrlCreateButton("Add",10,170,60,20)
$edit=GUICtrlCreateButton("Edit",70,170,60,20)
$remove=GUICtrlCreateButton("Remove",130,170,60,20)
$go=GUICtrlCreateButton("Go",190,170,60,20)
$load=GUICtrlCreateButton("Load",250,170,60,20)

$inputbox=GUICreate("<---Cancelled--->",300,100)
GUICtrlCreateLabel("<---Cancelled--->.",10,10,280,20)
$input_link=GUICtrlCreateInput("",10,35,280,20)
$ok2=GUICtrlCreateButton("OK",10,70,140,20)
$cancel2=GUICtrlCreateButton("Cancel",150,70,140,20)

$get_new=TrayCreateItem("<---Cancelled--->")
$settings=TrayCreateItem("Settings")
$list=TrayCreateItem("Links list")
TrayCreateItem("")
$help=TrayCreateItem("Help")
$website=TrayCreateItem("<---Cancelled---> Web Site")
$update=TrayCreateItem("Check updates")
$exit=TrayCreateItem("Exit")

If FileExists("settings.ini") Then
    GUICtrlSetData($lang,IniRead("settings.ini","Settings","Language",""))
    If IniRead("settings.ini","Settings","Run Windows","")=1 Then
    GUICtrlSetState($run_with_windows,$GUI_CHECKED)
    Else
    GUICtrlSetState($run_with_windows,$GUI_UNCHECKED)
    EndIf
    If IniRead("settings.ini","Settings","Tray","")=1 Then
    GUICtrlSetState($show_tray,$GUI_CHECKED)
    Else
    GUICtrlSetState($show_tray,$GUI_UNCHECKED)
    EndIf
    If IniRead("settings.ini","Settings","Balloon","")=1 Then
    GUICtrlSetState($show_balloon,$GUI_CHECKED)
    Else
    GUICtrlSetState($show_balloon,$GUI_UNCHECKED)
    EndIf
    If IniRead("settings.ini","Settings","Check","")="B" Then
    GUICtrlSetState($before,$GUI_CHECKED)
    Else
    GUICtrlSetState($every,$GUI_UNCHECKED)
    EndIf
    GUICtrlSetData($before_days,IniRead("settings.ini","Settings","Before Days",""))
    GUICtrlSetData($every_days,IniRead("settings.ini","Settings","Every Days",""))
    GUICtrlSetData($version,IniRead("settings.ini","Settings","Version",""))
EndIf
    
While 1
    $m=TrayGetMsg()
    $mm=GUIGetMsg()
    Select
    Case $mm=$load
        $load_file=FileOpenDialog("Select a Links list file to load","","Links list files (*.pll)",3)
        $loaded_file=FileOpen($load_file,0)
        For $u=1 To _FileCountLines($load_file)
        $read_line=FileReadLine($loaded_file,$u)
;~      MsgBox(0,"",$read_line)
        _GUICtrlListBox_AddString($list,$read_line)
        Next
    Case $mm=$go
        ShellExecute(GUICtrlRead($input_link))
    Case $mm=$remove
        _GUICtrlListBox_DeleteString($list,_GUICtrlListBox_GetCurSel($list))
    Case $mm=$cancel2
        GUISetState(@SW_HIDE,$inputbox)
    Case $mm=$ok2
        _GUICtrlListBox_AddString($list,GUICtrlRead($input_link))
    Case $mm=$add Or $mm=$edit
        GUISetState(@SW_SHOW,$inputbox)
    Case $m=$exit
        ExitLoop
    Case $m=$settings
        GUISetState(@SW_SHOW,$settings_gui)
    Case $m=$list
        GUISetState(@SW_SHOW,$links_gui)
    Case $mm=$ok
        $lang_ini=GUICtrlRead($lang)
        If GuiCtrlRead($run_with_windows)=$GUI_CHECKED Then
        $run_windows=1
        Else
        $run_windows=0
        EndIf
        If GuiCtrlRead($show_tray)=$GUI_CHECKED Then
        $tray=1
        ElseIf GuiCtrlRead($show_tray)=$GUI_UNCHECKED Then
        $tray=0
        EndIf
        If GuiCtrlRead($show_balloon)=$GUI_CHECKED Then
        $balloon=1
        Else
        $balloon=0
        EndIf
        If GuiCtrlRead($before)=$GUI_CHECKED Then
        $before_ini=1
        Else
        $before_ini=0
        EndIf
        If GuiCtrlRead($every)=$GUI_CHECKED Then
        $every_ini=1
        Else
        $every_ini=0
        EndIf
        $version_ini=GUICtrlRead($version)
        If $before_ini=1 Then
        $check="B"
        Else 
        $check="E"
        EndIf
        $read_before_days=GUICtrlRead($before_days)
        $read_every_days=GUICtrlRead($every_days)
        
        IniWrite("settings.ini","Settings","Language",$lang_ini)
        IniWrite("settings.ini","Settings","Run Windows",$run_windows)
        IniWrite("settings.ini","Settings","Tray",$tray)
        IniWrite("settings.ini","Settings","Balloon",$balloon)
        IniWrite("settings.ini","Settings","Check",$check)
        IniWrite("settings.ini","Settings","Before Days",$read_before_days)
        IniWrite("settings.ini","Settings","Every Days",$read_every_days)
        IniWrite("settings.ini","Settings","Version",$version_ini)
        
        GUISetState(@SW_HIDE,$settings_gui)
    Case $mm=$cancel
        GUISetState(@SW_HIDE,$settings_gui)
    Case $mm=$gui_event_close
        GUISetState(@SW_HIDE,$settings_gui)
        GUISetState(@SW_HIDE,$links_gui)
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

FSoft,

Look at lines 47 and 62. Do you see the problem?

M23

P.S. And please do not SHOUT - it is not polite ;-).


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Sorry, 3 words:

I'm very idiot!

bye

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0