Thread Hilfe bei einer Sub...: ich komm nicht so ganz weiter...
(13 answers)
Opened by
zipster
at 2006-06-02 12:16
User since 2004-09-06
458
Artikel
BenutzerIn
Hi,
ich hänge momentan ziemlich fest und hoffe ihr könnt mir irgendwie weiterhelfen oder wenigstens ein paar gute Ideen geben. *Renee und PTK und... anschau ;) *
Also Fehler oder so was habe ich nicht, weiß einfach nur nicht wie ich's umsetzten soll.
Ich bau ein Fenster auf und würde hierfür gern eine sub schreiben.
Da es aber ziemlich viel unterschiede in den sonst gleichen Befehlen gibt weiß ich nicht so recht wie ich's umsetzten soll.
Jetzt erstmal ein kleiner Bespiel Code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
... #zeile1 if ( $ref_hash_konfig->{pfeil_zurueck} == '1'){ $frame_kontakte_haupt->Button(-text => '<<', -command => [\&eintrag_zurueck],)->grid(-row=>'0', -column=>'0', -sticky => 'w'); } if ( $ref_hash_konfig->{nachname} == '1'){ $frame_kontakte_haupt->Label(-text => "Nachname:")->grid(-row=>'0', -column=>'1', -sticky => 'w'); $frame_kontakte_haupt->Entry(-textvariable=> \$ref_hash_haupt->{nachname}, -state => '$ref_hash_berechtigung->{nachname}')->grid(-row=>'0', -column=>'2', -sticky => 'w'); } else{ $spacer1 = $frame_kontakte_haupt->Photo('-format' => 'png', -file => 'images/spacer1.png'); $frame_kontakte_haupt->Label(-image => $spacer1, -width => "200", -height => "10")->grid(-row=>'0', -column=>'1', -columnspan => '2', -sticky => 'w'); } if ( $ref_hash_konfig->{vorname} == '1'){ $frame_kontakte_haupt->Label(-text => "Vornamen:")->grid(-row=>'0', -column=>'3', -sticky => 'w'); $frame_kontakte_haupt->Entry(-textvariable=> \$ref_hash_haupt->{vorname})->grid(-row=>'0', -column=>'4', -sticky => 'w'); } else{ $spacer2 = $frame_kontakte_haupt->Photo('-format' => 'png', -file => 'images/spacer2.png'); $frame_kontakte_haupt->Label(-image => $spacer2, -width => "242", -height => "10")->grid(-row=>'0', -column=>'3', -columnspan => '2', -sticky => 'w'); } if ( $ref_hash_konfig->{pfeil_vor} == '1'){ $frame_kontakte_haupt->Button(-text => '>>', -command => [\&eintrag_vor])->grid(-row=>'0', -column=>'5', -sticky => 'w'); } if ( $ref_hash_konfig->{zimmer_bett} == '1'){ $frame_kontakte_haupt->Label(-text => "Zimmer / Bett:")->grid(-row=>'0', -column=>'6', -sticky => 'w'); $frame_kontakte_haupt->BrowseEntry( -variable => \$ref_hash_haupt->{zimmerbett})->grid(-row=>'0', -column=>'7', -sticky => 'w'); } else{ $spacer3 = $frame_kontakte_haupt->Photo('-format' => 'png', -file => 'images/spacer3.png'); $frame_kontakte_haupt->Label(-image => $spacer3, -width => "232", -height => "10")->grid(-row=>'0', -column=>'6', -columnspan => '2', -sticky => 'w'); } ... #zeile2 if ( $ref_hash_konfig->{anrede} == '1'){ $frame_kontakte_haupt->Label(-text => "Anrede:")->grid(-row=>'1', -column=>'1', -sticky => 'w'); $frame_kontakte_haupt->BrowseEntry(-variable => \$ref_hash_haupt->{anrede}, -colorstate => 'white',)->grid(-row=>'1', -column=>'2', -sticky => 'w'); } else{ $spacer1 = $frame_kontakte_haupt->Photo('-format' => 'png', -file => 'images/spacer1.png'); $frame_kontakte_haupt->Label(-image => $spacer1, -width => "200", -height => "10")->grid(-row=>'1', -column=>'1', -columnspan => '2', -sticky => 'w'); } ... #zeile3 if ( $ref_hash_konfig->{geburtstag} == '1'){ $frame_kontakte_haupt->Label(-text => "Geburtstag:")->grid(-row=>'2', -column=>'1', -sticky => 'w'); $frame_kontakte_haupt->Entry(-textvariable=> \$ref_hash_haupt->{geburtstag})->grid(-row=>'2', -column=>'2', -sticky => 'w'); } else{ $spacer1 = $frame_kontakte_haupt->Photo('-format' => 'png', -file => 'images/spacer1.png'); $frame_kontakte_haupt->Label(-image => $spacer1, -width => "200", -height => "10")->grid(-row=>'2', -column=>'1', -columnspan => '2', -sticky => 'w'); } ... #zeile4 ...
Ich würde gern folgenden Befehl als sub erstellen lassen
if ( $ref_hash_konfig->{nachname} == '1'){ $frame_kontakte_haupt->Label(-text => "Nachname:")->grid(-row=>'0', -column=>'1', -sticky => 'w'); $frame_kontakte_haupt->Entry(-textvariable=> \$ref_hash_haupt->{nachname}, -state => '$ref_hash_berechtigung->{nachname}')->grid(-row=>'0', -column=>'2', -sticky => 'w'); } else{ $spacer1 = $frame_kontakte_haupt->Photo('-format' => 'png', -file => 'images/spacer1.png'); $frame_kontakte_haupt->Label(-image => $spacer1, -width => "200", -height => "10")->grid(-row=>'0', -col vonumn=>'1', -columnspan => '2', -sticky => 'w'); }
Ich hänge bei folgenden Bereichen
wie mach ich das wenn ich eine unterschiedliche Anzahl von Wigdetparamter habe (einmal nur "-text" und einmal "-variable", "-colorstate"usw...)????
wie mache ich das wenn ich einmal columnspan dabei habe und einmal nicht????
wie mach ich das wenn ich einmal ein Widget aufrufe und einmal 2????
Vielen Dank
Gruß
Seri aka zipster
View full thread Hilfe bei einer Sub...: ich komm nicht so ganz weiter...
|