Autore Topic: Come copiare un Frame contenente vari controlli  (Letto 281 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.723
  • Ne mors quidem nos iunget
    • Mostra profilo
Come copiare un Frame contenente vari controlli
« il: 21 Dicembre 2013, 14:00:50 »
Riporto questa discussione apparsa nella M.L. ufficiale:


" I want to show various CsvLines in a ScrollView.
 Each line will be splitted and filled in a bunch of controls which are
 all neatly placed and formatted in a "SourceFrame".

 My question:
 Is there an easy way to copy/paste that "SourceFrame" depending on the
 (flexible) amount of CsvLines ?


 Or in other 'words':
 
Codice: [Seleziona]
FrameDat0: TextBoxTxt0, CheckBoxLock0, .., BtnSaveFrameDat0
  and
 
Codice: [Seleziona]
N=AmountCsvLines

shall become
 
Codice: [Seleziona]
FrameDat0: TextBoxTxt0, CheckBoxLock0, .., BtnSaveFrameDat0
 FrameDat1: TextBoxTxt1, CheckBoxLock1, .., BtnSaveFrameDat1
 FrameDat2: TextBoxTxt2, CheckBoxLock2, .., BtnSaveFrameDat2
  ..
 FrameDatN: TextBoxTxtN, CheckBoxLockN, .., BtnSaveFrameDatN

I can do that in the IDE by copy/paste, but how to do it by code?
 Using a gridview does not allow all the formatting I need.

Tobias Boege
"


" Well, you can copy your SourceFrame and stuff but I won't elaborate on this
way until you explicitly rejected the sane OOP way :-)

Which goes like this:

- create a form "CsvLine",
- arrange your TextBoxes, CheckBoxes, ..., Buttons on it,
- write a _new() method which takes a CSV line and parses it into the
   controls,
- create an array of these Forms into a container on your main form (one
   for each CSV line).

This is a quite advanced topic; hope you can deal with the strategy above...

IIRC, you're german. You can have a look at an article where we created
custom controls using Forms
 http://www.gambas-buch.de/dw/doku.php?id=k18:k18.12:start
or my project
 http://www.gambas-buch.de/dw/doku.php?id=k27:k27.4:start
where this is done moreexcessively.

Regards,
Tobi
"
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »