Jump to content

Confussed by Combobox


RaiNote
 Share

Recommended Posts

Good evening all,

My Question is how to make that my GUI Combobox gets a text of an file but If i press some functions it will Show someother Thing but from another file.

ITEM1|ITEM2|ITEM3|...

will be inplented in the Combobox but if it gets as example ITEM3 it will Show up the third one of

1023|7632|3123|...

"3123" will be showed within a MsgBox or written to another file o_o

I am asking because i don't want to make for every single ITEM of the Combobox an GuictrlRead($blabla) >.< would there be a faster way :/

Thanks in advance. ;)

Edited by RaiNote
  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Link to comment
Share on other sites

RaiNote,

Assuming a one to one correspondence of combo items to lines in file...

#include <GUIConstantsEx.au3>
#include <GuiComboBox.au3>
#include <file.au3>
#include <array.au3>

; read the files to arrays...do not populate offest 0 with count
local $aFile1, $aFile2
_FileReadToArray(@scriptdir & '\File1.txt', $aFile1, $FRTA_NOCOUNT)
_FileReadToArray(@scriptdir & '\File2.txt', $aFile2, $FRTA_NOCOUNT)

local $gui010 = guicreate('Combo Example')

local $cFile1 = GUICtrlCreateCombo('',20,50,100,20)
guictrlsetdata($cFile1,_arraytostring($aFile1,'|'),$aFile1[0])

guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
        case $cFile1
            msgbox($MB_SYSTEMMODAL,'Display Record', $aFile2[_GUICtrlComboBox_GetCurSel($cFile1)])
    EndSwitch

WEnd

kylomas

Files used for script...File2.txt   File1.txt 

 

Edited by kylomas
forgot to post files used for input

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
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
 Share

×
×
  • Create New...