This is mnoGoSearch's cache of https://lists.gambas-basic.org/pipermail/user/2006-September/013663.html. It is a snapshot of the page as it appeared during last crawling. The current page could have changed in the meantime.

Last modified: Sat, 02 Sep 2006, 00:33:06 CEST    Size: 10620
[Gambas-user] Question about Key in ColumnView

[Gambas-user] Question about Key in ColumnView

Charlie Reinl Karl.Reinl at ...9...
Sat Sep 2 00:33:06 CEST 2006



Salut,

where am I wrong, in the this Sub I Update tow equal ColumnView shown here :

  WITH cvwTranslate
    .Columns.Count = 4
    .Columns[0].Text = ("Untranslated")
    .Columns[0].AutoResize = FALSE
    .Columns[1].AutoResize = FALSE
    .Columns[2].Text = ("Comments")
    .Columns[2].AutoResize = FALSE
    .Columns[3].Text = ("myKey")
    .Columns[3].AutoResize = FALSE
  END WITH
  cvwTranslateORG = NEW ColumnView(ME)
    WITH cvwTranslateORG
    .Visible = FALSE
    .Columns.Count = 4
    .Columns[0].Text = ("Untranslated")
    .Columns[0].AutoResize = FALSE
    .Columns[1].AutoResize = FALSE
    .Columns[2].Text = ("Comments")
    .Columns[2].AutoResize = FALSE
    .Columns[3].Text = ("myKey")
    .Columns[3].AutoResize = FALSE
  END WITH

(I added .Columns[3] to store the Key)

I thought I can read the .Key from the ColumnView to set him in the seconde 
ColumnView.

But I alway get "1", who is my mistake ?

PRIVATE SUB UpdateOrg(OPTIONAL bNew AS Boolean = FALSE)
DIM nI AS Integer
DIM sKey AS String
  IF bNew THEN cvwTranslateORG.Clear
  WITH cvwTranslate
    .MoveFirst
    DO WHILE .Available
      'sKey = .Key
      sKey = CStr(.item[3])
      IF bNew THEN 
        cvwTranslateORG.Add(sKey, .item[0])
        FOR ni = 1 TO .Columns.Count - 1
          cvwTranslateORG.Item[nI] = .item[nI]
        NEXT  
      ELSE
        cvwTranslateORG.MoveTo(sKey)
        cvwTranslateORG.Item[1] = .item[1] 
      ENDIF 
      .MoveNext
    LOOP
  END WITH
END

This Sub writes the hole cvwTranslate to cvwTranslateORG if  bNew  is TRUE, or 
if after initialisation keeps only the Values found by sKey.

You find this Sub in the attached *.class file , if you want to try it, this 
comes from gambas2 IDE (1.9.41) the translation tool

You will find left to the buttons a ComboBox where you can switch down to each 
file.

Amicalment
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FTranslate.class
Type: application/x-java
Size: 19061 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20060902/b77e3b28/attachment.bin>
-------------- next part --------------
# Gambas Form File 1.0

{ FTranslate Form
  MoveScaled(7.1429,15.4286,101,79)
  'Move(50,108,707,553)
  Text = ("Project translation")
  Icon = Picture["icon:/16/language"]
  Arrangement = Arrange.Vertical
  Spacing = 8
  Padding = 8
  { Panel4 Panel
    MoveScaled(1,1,93,6)
    'Move(7,7,651,42)
    Background = Color.SelectedBackground
    Arrangement = Arrange.Horizontal
    Spacing = 8
    Padding = 8
    { PictureBox1 PictureBox
      MoveScaled(1,1,5,5)
      'Move(7,7,35,35)
      Picture = Picture["icon:/32/language"]
    }
    { Label2 Label
      MoveScaled(7,1,31,4)
      'Move(49,7,217,28)
      Font = Font["Bold,+2"]
      Foreground = Color.SelectedForeground
      AutoResize = True
      Text = ("Project translation")
    }
  }
  { HBox2 HBox
    MoveScaled(1,8,115,65)
    'Move(7,56,805,455)
    Expand = True
    Spacing = 8
    { cvwLang ColumnView
      MoveScaled(0,3,29,59)
      'Move(0,21,203,413)
      Sorted = True
      AutoResize = True
      Header = False
      ScrollBar = Scroll.Vertical
    }
    { VBox1 VBox
      MoveScaled(30,1,84,61)
      'Move(210,7,588,427)
      Expand = True
      Spacing = 8
      { ToolBar1 ToolBar
        MoveScaled(3,1,78,3)
        'Move(21,7,546,21)
        { cbxFileChoice ComboBox
          MoveScaled(52,-1,29,4)
          'Move(364,-7,203,28)
          Text = ("ComboBox1")
        }
        { btnClear ToolButton
          MoveScaled(0,0,3,3)
          'Move(0,0,21,21)
          ToolTip = ("Clear this translation")
          Text = ("")
          Picture = Picture["icon:/16/clear"]
        }
        { btnDoNotTranslate ToolButton
          MoveScaled(3,0,3,3)
          'Move(21,0,21,21)
          ToolTip = ("This string must not be translated")
          Text = ("")
          Picture = Picture["icon:/16/warning"]
        }
        { btnCopy ToolButton
          MoveScaled(6,0,3,3)
          'Move(42,0,21,21)
          ToolTip = ("Copy untranslated string")
          Text = ("")
          Picture = Picture["icon:/16/paste"]
        }
        { btnVerify ToolButton
          MoveScaled(9,0,3,3)
          'Move(63,0,21,21)
          ToolTip = ("Verify the translation")
          Text = ("")
          Picture = Picture["icon:/16/watch"]
        }
        { btnNext ToolButton
          MoveScaled(12,0,3,3)
          'Move(84,0,21,21)
          ToolTip = ("Find next untranslated string")
          Text = ("")
          Picture = Picture["icon:/16/down"]
        }
        { btnPrevious ToolButton
          MoveScaled(15,0,3,3)
          'Move(105,0,21,21)
          ToolTip = ("Find previous untranslated string")
          Text = ("")
          Picture = Picture["icon:/16/up"]
        }
        { txtFind TextBox
          MoveScaled(18,0,31,3)
          'Move(126,0,217,21)
          Text = ("")
        }
        { btnFind ToolButton
          MoveScaled(49,0,3,3)
          'Move(343,0,21,21)
          ToolTip = ("Find a string in translation")
          Text = ("")
          Picture = Picture["icon:/16/find"]
        }
        { Panel2 Panel
          MoveScaled(69,0,1,3)
          'Move(483,0,7,21)
          Visible = False
        }
      }
      { cvwTranslate ColumnView
        MoveScaled(3,6,80,29)
        'Move(21,42,560,203)
        Expand = True
        Sorted = True
        Resizable = False
        ScrollBar = Scroll.Vertical
      }
      { VBox2 VBox
        MoveScaled(2,37,80,19)
        'Move(14,259,560,133)
        Expand = True
        Spacing = 8
        { lblComment Label
          MoveScaled(1,1,48,3)
          'Move(7,7,336,21)
          Text = ("")
        }
        { txtOrig TextArea
          MoveScaled(4,4,73,7)
          'Move(28,28,511,49)
          Background = Color.Background
          Expand = True
          Text = ("")
          ReadOnly = True
          Wrap = True
        }
        { txtTranslate TextArea
          MoveScaled(3,12,73,5)
          'Move(21,84,511,35)
          Expand = True
          Text = ("")
          Wrap = True
        }
      }
      { lblInfo Label
        MoveScaled(2,56,73,3)
        'Move(14,392,511,21)
        Text = ("")
      }
    }
  }
  { VBox3 VBox
    MoveScaled(0,74,106,4)
    'Move(0,518,742,28)
    { Panel3 Panel
      MoveScaled(55,0,3,1)
      'Move(385,0,21,7)
    }
    { HBox1 HBox
      MoveScaled(0,1,101,3)
      'Move(0,7,707,21)
      Spacing = 8
      { btnNew Button
        MoveScaled(0,0,15,3)
        'Move(0,0,105,21)
        ToolTip = ("New translation")
        Text = ("&New...")
      }
      { btnUndo Button
        MoveScaled(16,0,15,3)
        'Move(112,0,105,21)
        ToolTip = ("Reload translation")
        Text = ("&Reload")
      }
      { btnDelete Button
        MoveScaled(32,0,15,3)
        'Move(224,0,105,21)
        ToolTip = ("Delete translation")
        Text = ("&Delete")
      }
      { btnImport Button
        MoveScaled(48,0,15,3)
        'Move(336,0,105,21)
        ToolTip = ("Import a translation file")
        Text = ("&Import...")
      }
      { btnExport Button
        MoveScaled(64,0,15,3)
        'Move(448,0,105,21)
        ToolTip = ("Export to a translation file")
        Text = ("&Export...")
      }
      { Panel1 Panel
        MoveScaled(81,0,3,3)
        'Move(567,0,21,21)
        Expand = True
      }
      { btnOK Button
        MoveScaled(85,0,15,3)
        'Move(595,0,105,21)
        Text = ("&Close")
      }
    }
  }
}


More information about the User mailing list