[Gambas-user] The tableview object internal error

GMLDIAS at ...87... GMLDIAS at ...87...
Mon Apr 18 17:31:07 CEST 2005


Hi!

The TableView Object dont work correct. When i select one column the result is next column
example: My tablevies list is: aaaa;bbb;ccc;ddd;eee;fff
                I'm select the item bbb and show the item ccc
In my previous version of gambas this object work correctly.

Excuse me my english is not very well

my program class:

PRIVATE $hConn AS Connection
PRIVATE $rData AS Result

PUBLIC SUB tbvData_Data(Row AS Integer, Column AS Integer)

  $rData.MoveTo(Row)
 
  tbvData.Data.Text = Str($rData[tbvData.Columns[Column].Text]) 
  mglobal.pNome = Str($rData[tbvData.Columns[0].Text]) 
 
END



PUBLIC SUB tbvData_Click()

  ME.Close

END

PUBLIC SUB tbvData_KeyPress()

  IF Key.Code = Key.Return OR Key.Code = Key.Enter THEN ME.Close
 
  IF Key.Code = Key.Esc OR Key.Code = Key.Escape THEN
    mglobal.pNome = ""
    ME.Close
  ENDIF

END

PUBLIC SUB achar_KeyRelease()
  DIM hTable AS Table
  DIM hField AS ResultField
  DIM sField AS String
  DIM iInd AS Integer
  DIM iLen AS Integer
  DIM tmpNome AS String
 
  INC Application.Busy
 
  $hConn = NEW Connection
  $hConn = mglobal.OpenConnection()

  tmpNome = achar.Text
  'tmpNome = soundex.MakeSondExString(tmpNome)
  $rData = mglobal.OpenRecordSet($hConn,"SELECT PC_NOME AS PACIENTE, PC_ENDERECO AS ENDERECO, PC_BAIRRO AS BAIRRO FROM Pacientes WHERE LEFT(PC_NOME," & Str(Len(tmpNome)) & ") = '" & tmpNome & "' ORDER BY PC_NOME;")

  tbvData.Rows.Count = 0
 
  tbvData.Columns.Count = $rData.Fields.Count

  FOR EACH hField IN $rData.Fields
   
    WITH hField
   
      tbvData.Columns[iInd].Text = .Name
      tbvData.Columns[iInd].Width = mglobal.WidthFromType(tbvData, .Type, .Length, .Name)

    END WITH
   
    INC iInd
  NEXT
 
  tbvData.Rows.Count = $rData.Count
 
FINALLY
 
  DEC Application.Busy
 
CATCH

  Message.Error("Cannot exec request." & "\n\n" & Error.Text)
 
END





More information about the User mailing list