Android Question B4A Redimensionner un tableau

sultan87

Active Member
Licensed User
Longtime User
Bonsoir
j'ai un tableau de panel
B4X:
    Dim panels() As Panel
par programme j'ajoute des panels
plutôt que de définir la dimension du tableau
B4X:
    Dim panels(7) As Panel
je voudrais qu'à chaque fois que j'ajoute un nouveau panel que je puisse redimensionner le tableau
j'ai essayé RedimPreserve mais je n'y arrive pas
est ce que quelqu'un peut m'aider
Pierre
 

klaus

Expert
Licensed User
Longtime User
I would suggest you to use a List instead of an Array.
When you add a new item the size of the List is automatically incremented.
When you remove one, the size is decremented

Je te suggère d'utiliser une List au lieu d'un Array.
Lorsque tu ajoutes un élément la taille de la List est automatiquement incrémentée.
Si tu en enlèves un, la taille est décrémentée.
 
Upvote 0

sultan87

Active Member
Licensed User
Longtime User
Merci pour la réponse
c'est que j'utilise un projet récupéré sur le forum pour faire dérouler des panels
ce projet que j'ai personnalisé fonctionne correctement en utilisant
B4X:
    Dim panels(7) As Panel
si je rajoute un panel il faut que je modifie cette ligne de code
ci-joint le projet
Pierre
 

Attachments

  • SlidingPanels.zip
    123.7 KB · Views: 54
Upvote 0

klaus

Expert
Licensed User
Longtime User
Here you are.
I replaced the Panels Array by a Panels List.
Attached the modified project.
Be aware that the Touch event of the does not work. Because you add a WebView on the Panels
I moved the declaration of WebView1 to the Create_Panels routine, i am afraid that you will get bad results.
This needed also to modify a bit the WebView1_PageFinished routine.

In the future you should ask your questions in Englisch, because this is the international forum and the language is English.
If you want to ask questions in French you should ask those in the French forum.
 

Attachments

  • SlidingPanels1.zip
    8.9 KB · Views: 63
Last edited:
Upvote 0

sultan87

Active Member
Licensed User
Longtime User
thank's Klaus
how to continue this discussion on the French forum my written english is not very good
Pierre
 
Upvote 0
Top