Grid with CheckBoxItems - how to define in IDE?
Moderator: Rathinagiri
Grid with CheckBoxItems - how to define in IDE?
I want to redefine piece of code and use Grid with CheckBoxItems.
I'm using IDE to design form. But, I can't see possibility for grid with CheckBoxItems. Am I wrong?
I'm using IDE to design form. But, I can't see possibility for grid with CheckBoxItems. Am I wrong?
- fouednoomen
- Posts: 188
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: Grid with CheckBoxItems - how to define in IDE?
See this code
aCtrl_1 := { 'CHECKBOX' , 'Ok' , 'No' }
aCtrl_2 := {'TEXTBOX','CHARACTER' ,'!!!!!!!!!!!'}
aCtrl_3 := {'TEXTBOX','CHARACTER' ,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'}
aCtrl_4 := {'TEXTBOX','CHARACTER' ,'!!!!!!'}
aCtrl_5 := {'TEXTBOX','CHARACTER' ,'!!!!!!!!!!!'}
aCtrl_6 := {'TEXTBOX','CHARACTER' ,'99999.999'}
aCtrl_7 := {'TEXTBOX','CHARACTER' ,'!!!'}
bdDisplay_1 := { || if ( This.CellValue = .T. , 'Ok' , 'No' ) }
bdDisplay_2 := { || This.CellValue }
bdDisplay_3 := { || This.CellValue }
bdDisplay_4 := { || This.CellValue }
bdDisplay_5 := { || This.CellValue }
bdDisplay_6 := { || This.CellValue }
bdDisplay_7 := { || This.CellValue }
@ 160,10 BROWSE Browse_1 ;
WIDTH 998 ;
HEIGHT 300 ;
HEADERS {'FC','Code' , 'Raison', 'N° Doc.', 'Date' , 'Total TTC' ,'Type','OK'} ;
WIDTHS { 40,120 ,450,100,120,100,100 ,40 } ;
FONT 'Arial' ;
SIZE 12 ;
IMAGE { "UnChecked.bmp","Checked.bmp" } ;
BACKCOLOR {180,205,205} ;
WORKAREA ART_CON ;
FIELDS { "iif(ASCAN(aRecs,Recno())<>0,'.T.','F')" ,'LEFT(COD_ART,8)' , 'LEFT(DES_ART,25)','LEFT(TYPE_VEN,6)', 'DAT_COM' , 'PRIX_TTC','LEFT(CF,2)','kit'} ;
JUSTIFY { BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_RIGHT , BROWSE_JTFY_LEFT } ;
WHEN { {||.T.} , {||.F.} , {||.F.} , {||.F.} , {||.F.} , {|| .F.} , {||.F.} , {||.F.} } ;
ON DBLCLICK DblClickBrowseScreen() ;
ON CHANGE (Art_Con->(dbGoTo(Win_1.Browse_1.value )), Update_livraison() )
.
.
.
.
STATIC FUNCTION DblClickBrowseScreen
Art_Con->(dbGoTo(Win_1.Browse_1.value ))
IF This.CellColIndex == 1
SelectRecord(@aRecs,This.Value)
This.Refresh()
If Art_con->kit = .T.
Replace Art_con->kit With .F.
Else
Replace Art_con->kit With .T.
EndIf
* Msgbox(art_con->kit)
* Win_1.Browse_1.save
Win_1.Browse_1.Refresh
ENDIF
RETURN(NIL)
aCtrl_1 := { 'CHECKBOX' , 'Ok' , 'No' }
aCtrl_2 := {'TEXTBOX','CHARACTER' ,'!!!!!!!!!!!'}
aCtrl_3 := {'TEXTBOX','CHARACTER' ,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'}
aCtrl_4 := {'TEXTBOX','CHARACTER' ,'!!!!!!'}
aCtrl_5 := {'TEXTBOX','CHARACTER' ,'!!!!!!!!!!!'}
aCtrl_6 := {'TEXTBOX','CHARACTER' ,'99999.999'}
aCtrl_7 := {'TEXTBOX','CHARACTER' ,'!!!'}
bdDisplay_1 := { || if ( This.CellValue = .T. , 'Ok' , 'No' ) }
bdDisplay_2 := { || This.CellValue }
bdDisplay_3 := { || This.CellValue }
bdDisplay_4 := { || This.CellValue }
bdDisplay_5 := { || This.CellValue }
bdDisplay_6 := { || This.CellValue }
bdDisplay_7 := { || This.CellValue }
@ 160,10 BROWSE Browse_1 ;
WIDTH 998 ;
HEIGHT 300 ;
HEADERS {'FC','Code' , 'Raison', 'N° Doc.', 'Date' , 'Total TTC' ,'Type','OK'} ;
WIDTHS { 40,120 ,450,100,120,100,100 ,40 } ;
FONT 'Arial' ;
SIZE 12 ;
IMAGE { "UnChecked.bmp","Checked.bmp" } ;
BACKCOLOR {180,205,205} ;
WORKAREA ART_CON ;
FIELDS { "iif(ASCAN(aRecs,Recno())<>0,'.T.','F')" ,'LEFT(COD_ART,8)' , 'LEFT(DES_ART,25)','LEFT(TYPE_VEN,6)', 'DAT_COM' , 'PRIX_TTC','LEFT(CF,2)','kit'} ;
JUSTIFY { BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_RIGHT , BROWSE_JTFY_LEFT } ;
WHEN { {||.T.} , {||.F.} , {||.F.} , {||.F.} , {||.F.} , {|| .F.} , {||.F.} , {||.F.} } ;
ON DBLCLICK DblClickBrowseScreen() ;
ON CHANGE (Art_Con->(dbGoTo(Win_1.Browse_1.value )), Update_livraison() )
.
.
.
.
STATIC FUNCTION DblClickBrowseScreen
Art_Con->(dbGoTo(Win_1.Browse_1.value ))
IF This.CellColIndex == 1
SelectRecord(@aRecs,This.Value)
This.Refresh()
If Art_con->kit = .T.
Replace Art_con->kit With .F.
Else
Replace Art_con->kit With .T.
EndIf
* Msgbox(art_con->kit)
* Win_1.Browse_1.save
Win_1.Browse_1.Refresh
ENDIF
RETURN(NIL)
- Attachments
-
- grid with CheckBoxItems.png (112.13 KiB) Viewed 2598 times
Re: Grid with CheckBoxItems - how to define in IDE?
Thank you.
But, I want to do it with IDE. I don't want to define control in my .prg code
But, I want to do it with IDE. I don't want to define control in my .prg code
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Grid with CheckBoxItems - how to define in IDE?
Hi Mol,
It seems something like this ...
Best regards,
Salamandra - Brazil
No, you can´t , but you can enable checkboxes at window loading time
Code: Select all
LOAD WINDOW users_edit
ON KEY CONTROL+T OF users_edit ACTION tagAll(z)
ON KEY CONTROL+U OF users_edit ACTION tagNone(z)
users_edit.Title:=':: Users - Add a new user.'
/* Enable checkboxes here */
users_edit.Grid_1.CheckBoxEnabled := .T.
users_edit.Grid_1.Value:=1
users_edit.tbNomeUsuario.SetFocus
CENTER WINDOW users_edit
ACTIVATE WINDOW users_edit
Best regards,
Salamandra - Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
Re: Grid with CheckBoxItems - how to define in IDE?
But, another question. How to use ON CHECKBOXCLICKED event?
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Grid with CheckBoxItems - how to define in IDE?
Hi Mol,
This is an example about how to change row backcolor when checkbox is set to .T.
and this is an example about how to verify how many (and which) checkboxes are .T. or .F.
Best regards,
Salamandra - Brazil
This is an example about how to change row backcolor when checkbox is set to .T.
Code: Select all
LOCAL bColor := {|| if ( users_edit.Grid_1.CheckBoxItem (This.CellRowIndex) == .T. , { 202,255,202 } , { 255,255,255 } ) }
and this is an example about how to verify how many (and which) checkboxes are .T. or .F.
Code: Select all
For k:=1 TO users_edit.Grid_1.ItemCount
h += IIF( users_edit.Grid_1.CheckBoxItem(k) == .T., 1, 0 )
Next k
Best regards,
Salamandra - Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
Re: Grid with CheckBoxItems - how to define in IDE?
You don't understand me - I want to do action when user checks position
Re: Grid with CheckBoxItems - how to define in IDE?
My working code:
Code: Select all
OknoRaportObrotuTowarow.G_Grupy.CheckBoxEnabled := .T.
i := GetControlIndex("G_Grupy", "OknoRaportObrotuTowarow")
_HMG_SYSDATA [ 40 ] [ i ] [ 46 ] := {||OknoRaportObrotuTowarow_G_Grupy_CheckBoxClicked()}
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Grid with CheckBoxItems - how to define in IDE?
Hi Mol,
Take a look at the sample at \hmg.3.4.3\SAMPLES\Controls\Grid\Grid_CheckBoxes\demo.prg
Salamandra - Brazil
I did not get to work the ON CHECKBOXCLICKED event when the grid it´s designed by IDE, althought this is not my need too.You don't understand me - I want to do action when user checks position
Take a look at the sample at \hmg.3.4.3\SAMPLES\Controls\Grid\Grid_CheckBoxes\demo.prg
Salamandra - Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
Re: Grid with CheckBoxItems - how to define in IDE?
I'm using it for first item "Select/Unselect ALL" - if user check or uncheck first item - all others are chcecked or unchecked:
Code: Select all
if This.CellRowClicked == 1
for i:=2 to len(aGrupyNazwy)
OknoRaportObrotuTowarow.G_Grupy.CheckBoxItem(i) := OknoRaportObrotuTowarow.G_Grupy.CheckBoxItem(1)
next i
else
if !OknoRaportObrotuTowarow.G_Grupy.CheckBoxItem(This.CellRowClicked)
StopControlEventProcedure ( "G_Grupy", "OknoRaportObrotuTowarow", .t. )
OknoRaportObrotuTowarow.G_Grupy.CheckBoxItem(1) := .F.
StopControlEventProcedure ( "G_Grupy", "OknoRaportObrotuTowarow", .f. )
endif
endif