Jump to content

List <-> Array


Denver
 Share

Recommended Posts

Edit : I'll use an other way to have the lists, then it doesn't care if this thread is not answered. :)

Hi,

(It's hard to tell.)

I need to retrieve the position of an item in an existing list.

That list is just the GUI for an Array-display in a control.

I wanna select one entry in the list, attach it to the array, and send it to an other list+array.

So, the user just see : "List1[x]" -[addButton]> " List2[z]", while the script does "array1[x]" -> "array2[z]".

Afterthat, some upgrades would check if an entry has not already been selected, or alike.

And opposite, "List2[z]" -[delButton]> "", and "array2[z]" desappears.

;just test vars
Global  $NbLignes = 2
Global  $Separ = 2 ;Séparateur, hauteur en pixels entre deux lignes
Global  $Hligne = 13 ;hauteur présumée par ligne ( 13 pixels de haut )
Global  $Ht = $Separ + 2 * $Hligne
Dim $aLog[21] = ["nm", 1, "nm", 2, "nm", 3, "nm", 4, "nm", 5, "nm", 6, "nm", 7, "nm", 8, "nm", 9, "nm", 10, "nm"]

;"real" vars
Local   $Liste
Local   $CoListe
Local   $aLogMulti

$fenListe = GUICreate ( @scriptname & " - Multi-connexion" )
$LabelListe = GUICtrlCreateLabel ( "Sélectionnez les comptes, et l'ordre de connexion:", 0, 0 )
$BAjoute = GUICtrlCreateButton ( "Ajouter ->", 100, 70 )
$BSuppre = GUICtrlCreateButton ( "<- Retirer ", 100, 160 )
$Liste = GUICtrlCreateList ( "", 0, $Hligne, 100, 250 )
$compteBis = 1
While   $compteBis < ( UBound ( $aLog ) ) / $NbLignes
    GUICtrlSetData ( $Liste, $aLog [ ( $compteBis ) * $NbLignes - 1 ] & "|" )
    $compteBis += 1
WEnd
$CoListe = GUICtrlCreateList ( "", 200, $Hligne, 100, 250 )

GUISetState ()

While   1
    $Cmsg = GUIGetMsg ()
    Switch  $Cmsg
        Case    0
            ContinueLoop
        Case    -3 ;$GUI_EVENT_CLOSE
            ExitLoop

        Case    $BAjoute
            $tempvar = GUICtrlRead ( $Liste, 1 )
            GUICtrlSetData ( $CoListe, $tempvar & "|" )
            ;add there n° of the line $Liste selected to Ubound $aLogMulti (Just need how to retrieve the n°)

        Case    $BSuppre
            $tempvar = GUICtrlRead ( $CoListe, 1 )
            ;Del there n° of the line $CoListe selected from $aLogMulti (Item than last comment)

    EndSwitch
WEnd

I've found some kinda answers, but all according to "Listview" control, nothing to "List" control.

Someone could help me ?

D.

Edited by Denver
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...