Jump to content

populate listbox by pseudo udf

Recommended Posts


hi guy 

i  have  a program  with  listbox   and  i  have  created  a pseudo  udf  for populate a listbox , or  populate  combobox  ,( depend  of  cases) , but  not  work  properly . with messagebox work ,but not  populate 

the  script 

; Script Start - Add your code below here
#include <AutoItConstants.au3>
#include <GUIConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <WinAPIRes.au3>
#include <GuiListView.au3>
#include <File.au3>

;#include "ModernMenu.au3"
;#include "E:\_GESTIONALE_NEW\include\ModernMenuRaw.au3" ; Only unknown constants are declared here
#include "include\ModernMenuRaw.au3" ; Only unknown constants are declared here
;#include "E:\_GESTIONALE_NEW\include\menu.au3" ; include i menu
#include "include\menu.au3" ; include i menu
#include "include\ADO.au3" ;  include function for adodb
#include "include\DB.au3" ;  include function di aggancio del db + futuribile new sql language
#include "include\Language.au3" ;  include language
#include "include\Variabili.au3" ;  include variabili globali
#include "include\distructor_gui.au3" ;  include distruttore degli elementi sopra la gui
#include "include\GUI_Configure.au3" ;  include logica della gui configure


Opt("GuiOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 128)
;Global $Lang[10]

Global $ListBox2


Func _gui()

$Form1 = GUICreate("Choices Dialog", 353, 263, 302, 218)
$ListBox1 = GUICtrlCreateList("", 8, 8, 137, 201)
GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5")
$Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25)
$Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25)
$Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25)
$ListBox2 = GUICtrlCreateListView("", 200, 8, 137, 201)
_GUICtrlListView_SetExtendedListViewStyle($ListBox2, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) ; questa stringa fa la griglia stile excel
    GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 220)
$Button5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25)
$Button6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25)
$Button7 = GUICtrlCreateButton("&Help", 264, 225, 75, 25)

    GUISetOnEvent($GUI_EVENT_CLOSE, "_close")

_Read_ini_Multi_Output(0,$ListBox2 ,'motifCONTI.ini', 'Pagamento_Conti', 'key')


Func _close()


EndFunc   ;==>_close


;Keep the GUI alive


While 1



the  pseudo udf 


#cs ----------------------------------------------------------------------------

    AutoIt Version:
    Author:         faustf

    Script Function: Gui_configuration for gestionale per ufffico NEW
    Template AutoIt script.
    logica della gui configure

#ce ----------------------------------------------------------------------------

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <File.au3>

;_Read_ini_Multi_Output(0,'motifCONTI.ini', 'Pagamento_Conti', 'key')

Func _Read_ini_Multi_Output($list_or_comb, $List, $name_ini, $section_ini, $key_ini)
    $conf_key_num = 1
    $conf_path = @ScriptDir & "\CONFIGURE\company\" & $name_ini
    $Num_line = _FileCountLines($conf_path)
    $Num_line -= 1

    If $list_or_comb = 0 Then ;  list listviewe

            $var = IniRead($conf_path, $section_ini, $key_ini & $conf_key_num, "NotFound")
             GUICtrlCreateListViewItem($var, $List)

            $conf_key_num += 1
        Until $conf_key_num = $Num_line

    Else ; list combobox
            $var = IniRead($conf_path, $section_ini, $key_ini & $conf_key_num, "NotFound")
            ;_GUICtrlComboBox_AddString($combo1, $var)
            $conf_key_num += 1
        Until $conf_key_num = $Num_line

EndFunc   ;==>_Read_ini_Multi_Output

someone can help  me ?? , thankzz  alot :)


Edited by faustf

Share this post

Link to post
Share on other sites

sorry i find  a solution  i answer   at me :)

i must insert this   _GUICtrlListView_InsertColumn($ListBox2, 0, "Column 1", 100)


Share this post

Link to post
Share on other sites

@BrewManNH in one of post said about  _GUICtrlListview_AddArray


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button


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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-09-20

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