deleteddd

Post

Posted
Rating:
#1 (In Topic #948)
Trainee
deleteddeleted
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
thatbruce is in the usergroup ‘Regular’

bored said

I use gambas 2.2 or something btw.
Very seriously, if that is true then if I were you I'd be looking to upgrade. I doubt anyone here could help. Version 2.2 was a very long time ago.

Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
 Hi bored and welcome to the forum.

I have to agree with thatbruce. The Gambas version 2.23 was released in April 2011! We are now up to version 3.17.3.

What distro are you using?
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
There are tricks. For example use this:

Code (gambas)

  1. SELECT CASE WHEN (Select sum(id) Block From Table1 Where id=Table2.id) > 0 THEN '☒' ELSE ' ' END AS  Block From ....
  2.  

in a select from the database and receive a field from the record with the check or uncheck and when you click on the table you save the check uncheck in the database.

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
You could use the cells Picture property to be a checkbox picture , either selected or unselected.

See the code below.
First i create both selected and unselected checkbox pictures to use.
Then in column[1] i set each rows text and use the unselected checkbox picture for column[0].
the IsSelected() method checks if the picture in column[0] is the off image or not.
as the form closes it tells you the values of the checkboxes.

You can easily set values on load in the tableview checkboxes by using either the pOn or pOff pictures
You could easily use a different column number

Hope it helps…

Code (gambas)

  1. ' Gambas class file
  2.  
  3. Private pOff As New Picture(24, 24)
  4. Private pOn As New Picture(24, 24)
  5.  
  6. Public Sub Form_Open()
  7.  
  8.   ' make our selected and unselected checkbox images
  9.   Paint.Begin(pOff)
  10.   Style.PaintCheck(0, 0, 24, 24, False)
  11.   Paint.End
  12.  
  13.   Paint.Begin(pOn)
  14.   Style.PaintCheck(0, 0, 24, 24, True)
  15.   Paint.End
  16.  
  17.   TableView1.Columns.Count = 2
  18.  
  19.   For c As Integer = 0 To 9
  20.     Inc TableView1.Rows.Count
  21.     TableView1[TableView1.Rows.Max, 0].Picture = pOff
  22.     TableView1[TableView1.Rows.Max, 1].Text = "Item " & c
  23.   Next
  24.  
  25.   TableView1.Columns[0].Width = -1
  26.  
  27.  
  28. Public Sub TableView1_Click()
  29.  
  30.   If TableView1.Column = 0 Then
  31.     If IsSelected(TableView1.Current) Then
  32.      ' Do your function if checking off
  33.       TableView1.Current.Picture = pOff
  34.     Else
  35.      ' Do your function if checking on.
  36.       TableView1.Current.Picture = pOn
  37.     Endif
  38.  
  39.  
  40. Private Sub IsSelected(Cell As _GridView_Cell) As Boolean
  41.  
  42.   If Cell.Picture = pOff Then Return False
  43.  
  44.  
  45. Public Sub ButtonClose_Click()
  46.  
  47.   For c As Integer = 0 To TableView1.Rows.Max
  48.     Print TableView1[c, 0].Text, IsSelected(TableView1[c, 0])
  49.   Next
  50.  
  51.  
  52.  

I guess something like this (put your condition in WhateverMakesItTrue)…

Code (gambas)

  1.  
  2. WITH dbResult
  3. tb.rows.count = .count
  4.       i = 0
  5.       WHILE i < .count
  6.         tb[i, 0].Picture = If(WhateverMakesItTrue, pOn, pOff)
  7.         tb[i, 0].Text = dbResult!name
  8.         tb[i, 1].Text = dbResult!width
  9.         tb[i, 2].Text = dbResult!height
  10.         tb[i, 3].Text = dbResult!isValid
  11.         i = i + 1
  12.         .MoveNext
  13.       WEND
  14.  
  15.  
Online now: No Back to the top
1 guest and 0 members have just viewed this.