combobox in grid

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
andyglezl
Posts: 1057
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 24 times
Been thanked: 46 times
Contact:

Re: combobox in grid

Post by andyglezl » Sat Nov 03, 2018 7:21 pm

Pues algo malo pasó con tu instalación, ya que como yo lo tengo,
todo está dentro de D:\HMG\3.4.4.
*------------------------------------------------------------------------------
Well something bad happened with your installation, because as I have it,
everything is inside D: \ HMG \ 3.4.4.
hmg344.png
hmg344.png (69.34 KiB) Viewed 243 times
Andrés González López
Desde Guadalajara, Jalisco. México.

franco
Posts: 297
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Sat Nov 03, 2018 8:37 pm

Do you think I should uninstall, redownload and reinstall.
Franco
Franco Bushie
Canada

User avatar
andyglezl
Posts: 1057
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 24 times
Been thanked: 46 times
Contact:

Post by andyglezl » Sun Nov 04, 2018 3:34 am

franco wrote:
Sat Nov 03, 2018 8:37 pm
Do you think I should uninstall, redownload and reinstall.
Franco
Creo que sería una buena opción.
*----------------------------------------------
I think it would be a good option.


Aunque pensando en tu problema, "quizá por error" hiciste un Tomar y Dejar
de la carpeta "MINGW" en "IDE_ANSI".
*---------------------------------------------------------------------------------------------
Although thinking about your problem, "maybe by mistake" you did a drag and drop
from the "MINGW" folder in "IDE_ANSI".
Andrés González López
Desde Guadalajara, Jalisco. México.

franco
Posts: 297
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Sun Nov 04, 2018 9:16 am

Thanks Andy
I do not think so but possible. I usually copy and paste.
I still have my buttons dropping captions. Maybe to do with bad install, but I think it is a memory thing. Do you think I Should create a new post for this. Also thanks again for thoughts on combo box. I like my idea of header click.
Franco
Franco Bushie
Canada

User avatar
tonton2
Posts: 271
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Has thanked: 6 times
Been thanked: 9 times
Contact:

Post by tonton2 » Wed Dec 05, 2018 7:45 pm

Bonsoir a toute l’équipe,
je voudrais savoir comment utiliser COMBOBOX dans la grille ,pour qu'il m'affiche les données et non pas le numero(rang)
ci joint votre exemple légèrement refait.
merci pour tous ce que vous faites.
Good evening to the whole team,
I would like to know how to use COMBOBOX in the grid, so that it shows me the data and not the number (rank)
here is your example slightly redone.
thank you for all that you do.
Attachments
Tableau.rar
(3.44 KiB) Downloaded 19 times
L'Algerie vous salut
Y.TABET

User avatar
andyglezl
Posts: 1057
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 24 times
Been thanked: 46 times
Contact:

Post by andyglezl » Sat Dec 08, 2018 3:41 pm

Lo sigo pensando...
+----------------------------
I keep thinking ...
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
serge_girard
Posts: 2153
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 464 times
Been thanked: 108 times
Contact:

Post by serge_girard » Sat Dec 08, 2018 5:29 pm

Tonton,

Do you mean this:

Code: Select all

ITEM IT101 == GROUP 1
ITEM IT102 == GROUP 2
ITEM IT103 == GROUP 3

OR

ITEM IT101 == GROUP 1
ITEM IT102 == GROUP 1
ITEM IT103 == GROUP 1
ITEM IT201 == GROUP 2
Serge

User avatar
andyglezl
Posts: 1057
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 24 times
Been thanked: 46 times
Contact:

Post by andyglezl » Sun Dec 09, 2018 4:20 am

Bueno, parece que algo anda mal... :(

He hecho varias pruebas con el grid utilizando el ROWSOURCE y al parecer no funciona el COMBOBOX
con el COLUMNCONTROLS ya que solo admite que el CAMPO sea numérico y se graba el indice del
combobox, no la descripción.

Al hacer la prueba con el GRID con ARRAY si funciona dejando la descripción.

Alguien más del foro lo ha probado o tiene otra opinión ?
+----------------------------------------------------------------------------------------------------------------------------
Well, it seems that something is wrong ... :(

I have done several tests with the grid using the ROWSOURCE and it seems that the COMBOBOX does not work
with the COLUMNCONTROLS since it only admits that the FIELD is numeric and the index of the
combobox, not the description.

When doing the test with the GRID with ARRAY if it works leaving the description.

Has anyone else in the forum tried it or have another opinion?

Code: Select all

#include <hmg.ch>
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.	
FUNCTION Main()

	DEFINE WINDOW Form_1 AT 0,0 WIDTH 640 HEIGHT 480 TITLE 'Combo Test' MAIN NOMAXIMIZE 
		aCuentas1 := aDays()
		aCuentas2 := aMonths()
		aCuentas3 := {}
		aArchs    := Directory( "C:\Windows\*.*" )
		FOR x:=1 TO len( aArchs )
			aadd( aCuentas3, aArchs[x,1] )
		NEXT
		aMiGrid   := {}
		FOR i1 = 1 TO 5
			AADD( aMiGrid, { 1, 2, 3, "Algo", "Algo" } )
		NEXT
		@ 100 , 10 GRID Grid_CSG WIDTH 770 HEIGHT 370     ;
				HEADERS { 'Cuenta', 'D/H', 'Formula', 'Concepto', 'Documento' }	 ;
				JUSTIFY { GRID_JTFY_LEFT , GRID_JTFY_CENTER , GRID_JTFY_LEFT , GRID_JTFY_LEFT , GRID_JTFY_LEFT }  ;
				WIDTHS  { 100 , 100 , 180 , 180 , 180 } ;
				VALUE 1 EDIT EDITOPTION GRID_EDIT_DEFAULT ; //CELLNAVIGATION ;
				ITEMS aMiGrid ;
				COLUMNCONTROLS { { 'COMBOBOX', aCuentas1 }, ;
	           					{ 'COMBOBOX', aCuentas2 }, ;
								{ 'COMBOBOX', aCuentas3 }, ;
								{'TEXTBOX' ,'CHARACTER','!!!!!!!!'}, ;
								{'TEXTBOX' ,'CHARACTER','!!!!!!!!'} } 
	END WINDOW
    CENTER WINDOW Form_1
    ACTIVATE WINDOW Form_1
RETURN nil





*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
/*



#include <hmg.ch>
static    aRefMatPrem := {}
*--------------------------------------------------------*
Function Main()
*--------------------------------------------------------*

	Createtable()
	Select PINV_IT
	go top
	    
   do while !eof()
      aadd(aRefMatPrem, ALLTRIM( PINV_IT->Item_no) )
      skip
   enddo

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 640 HEIGHT 480 ;
      TITLE 'Combo Test' ;
      MAIN NOMAXIMIZE ;
      ON RELEASE CLOSETABLES()

      DEFINE MAIN MENU
         DEFINE POPUP 'Test'
            ITEM "Exit"      ACTION  {||{ThisWindow.Release()}}
         END POPUP
      END MENU
*	@ 0,10 label label_1 ;
*	WIDTH 610 ;
*	HEIGHT 30 ;
*	TRANSPARENT ;
*	VALUE '' ;
* 	TOOLTIP 'Highlight Group to Change and Click Header3 to Change Group or Highlite Cost to Change and Hit Enter'

	@ 260,10 button button_1 ;
	caption 'Exit' ; 
	action  {||{ThisWindow.Release()}}
	
	msgdebug(aRefMatPrem )
    
	DEFINE GRID grid_1   
		ROW	30
		COL	10 
        WIDTH 610   
        HEIGHT 220     
        HEADERS { 'Inv' , 'Item' , 'Group (Edit)', 'Cost (Edit)' } 					// <=========== CHANGE
        WIDTHS { 100 , 100 , 100 , 100 } 
		VALUE 1
		COLUMNFIELDS { 'Inv_no' , 'Item_no' , 'Group' , 'Cost'} 
		COLUMNCONTROLS { 	{'TEXTBOX' , 'CHARACTER','!!!!!!!!'}			, ;
							{'TEXTBOX' , 'CHARACTER','!!!!!!!!!!!!!!!'}	, ;
							{'COMBOBOX', aRefMatPrem }			, ;			// <=========== CHANGE
							{'TEXTBOX' , 'NUMERIC','9999999.99'} }					
		ROWSOURCE "PINV_IT" 
		ALLOWEDIT .T.  
		// ; // COLUMNFIELDS { 'Inv_no' , 'Item_no' , 'Group' , 'Cost'}				// <===========  IT'S DUPLICATED !
		COLUMNWHEN { { || .F. },{ || .F. },{ || .T. },{ || .T. } } 					// <===========  CHANGE GROUP = .T.
		ON CHANGE  { ||{invprsave() } }  
	END GRID 
	 	


   END WINDOW
	FORM_1.GRID_1.REFRESH()
   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return nil


*--------------------------------------------------------*
Procedure CloseTables
*--------------------------------------------------------*

		//----------------------------------------------------------------		
		// PARA VER QUE PASA, YA QUE EL ARCHIVO ES TEMPORAL. 
		// TO SEE WHAT HAPPENS, SINCE THE ARCHIVE IS TEMPORARY.
		x:= ""
		GO TOP
		DO WHILE ! EOF()
			x := x + INV_NO + ' - ' + ITEM_NO + ' - ' + STR( GROUP ) + ' - ' + STR( COST ) + HB_OsNewLine()
			*x := x + INV_NO + ' - ' + ITEM_NO + ' - ' + GROUP + ' - ' + STR( COST ) + HB_OsNewLine()
			DBSKIP()
		ENDDO
		MSGBOX( x, "Lo Grabado/I saved it" )
		//----------------------------------------------------------------
		//----------------------------------------------------------------
	
		close PINV_IT
*		release PINV_IT
*		dbdrop('pinv_it')   // DOES NOT HELP LOCKUP
*		close GROUP
*		release GROUP         
*		dbdrop('group')
*		RELEASE MEMORY      // DOES NOT HELP LOCKUP
*		close all           // DOES NOT HELP LOCKUP
*		clear all           // DOES NOT HELP LOCKUP

Return

*--------------------------------------------------------*
Function CreateTable
*--------------------------------------------------------*

 Local CF1 := {}, TEMP := 1
		CF1 := {}
		aADD(CF1,{'INV_NO' , 'C' , 8,0})
		AADD(CF1,{'ITEM_NO', 'C' , 15,0})
		*Aadd(CF1,{'GROUP',   'C', 15,0})							// <=========== CHANGE "C" to "N"
		Aadd(CF1,{'GROUP',   'N', 1,0})
		Aadd(CF1,{'COST', 'N' , 10,2})

		if ! hb_dbcreatetemp("PINV_IT", cf1)
			msgbox("Cannot create temporary table: Item")
			RELEASE WINDOW ALL
			return nil
		endif
		if select("PINV_IT") = 0
			use PINV_IT new
		endif
		select PINV_IT 
		index on inv_no to PINV_IT
		do while temp < 10
			append blank
			replace inv_no with 'IN'+alltrim(str(temp+1000))
			replace item_no with 'IT'+alltrim(str(temp+100))
			replace cost with temp*100
			*replace GROUP with 'PARTS'								// <=========== CHANGE
			replace GROUP with 1
			temp:=temp+1
			loop
		enddo
		

*		CF1 := {}
*		aADD(CF1,{'GROUP' , 'C' , 15, 0} )
*
*		if ! hb_dbcreatetemp("GROUP", cf1)
*			msgbox("Cannot create temporary table: Item")
*			RELEASE WINDOW ALL
*			return nil
*		endif
*		if select("GROUP") = 0
*			use GROUP new
*		endif
*		select GROUP
*		append blank
*		replace GROUP with 'PARTS'
*		append blank
*		replace GROUP with 'LABOUR'
Return Nil


*------------------------------------------------------------------------------*
Function Invprsave
*------------------------------------------------------------------------------*
local ctot := 0, stot := 0, rec := recno(), acellpr
*	acellpr := Form_1.Grid_1.value
*	*Form_1.grid_1.save
*	if alias() = 'GROUP'
*		SELECT PINV_IT
*		go Form_1.Grid_1.recno
*		REPLACE GROUP WITH GROUP->GROUP
*		Form_1.Grid_1.REFRESH()
*	ENDIF
	Form_1.grid_1.save
	sum cost to ctot
*	Form_1.Grid_1.setfocus
*	Form_1.Grid_1.VALUE := {acellpr[1],acellpr[2]}
*	go Form_1.Grid_1.recno
 
return

/*

*------------------------------------------------------------------------------*
Function Changegroup
*------------------------------------------------------------------------------*
	select GROUP
  IF .NOT. ISWINDOWACTIVE(grbrw)
	
	DEFINE WINDOW grbrw ;
		AT  110,10 ; //R1+80, C1+10 ;
		WIDTH 300;      //GetDesktopWidth() * 0.75 ;
		HEIGHT 300 ;  // GetDesktopHeight() * 0.75 ;
		TITLE 'Press Escape to Exit' ;
		MODAL ;
		NOSIZE  ;
		SYSMENU .t. ;
   	   	ON RELEASE Invprsave() 

	
	DEFINE BROWSE gbrw
		ROW 10    
		COL 20     
		WIDTH 130
		HEIGHT 290
		BACKCOLOR {181,205,106}     //{180,62,60}
		*BACKCOLOR    { 180, 180, 200}
		FONTCOLOR { 0, 0, 0 }
		HEADERS  {'Group' }
		WIDTHS   {100}
		WORKAREA  GROUP  //inv
		FIELDS { 'GROUP'}
		VALUE 1
		READONLY .T.
		VSCROLLBAR .T.
 		ONDBLCLICK { || dbgoto(THIS.VALUE),  grbrw.release }
	END BROWSE

	END WINDOW
        CENTER WINDOW grbrw
        ACTIVATE WINDOW grbrw
  ELSE
	RETURN
  ENDIF

Return nil
*/



*/

Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
tonton2
Posts: 271
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Has thanked: 6 times
Been thanked: 9 times
Contact:

Post by tonton2 » Sun Dec 09, 2018 10:36 am

Bonjour ,
je vais mettre un exemple avec COMBOBOX dans une grille ou ça marche

I'll put an sample with COMBOBOX in a grid or it works
L'Algerie vous salut
Y.TABET

User avatar
tonton2
Posts: 271
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Has thanked: 6 times
Been thanked: 9 times
Contact:

Post by tonton2 » Sun Dec 09, 2018 11:21 am

Hi
voila l'exemple
Attachments
Sample_Combo_Grid.rar
(48.58 KiB) Downloaded 11 times
L'Algerie vous salut
Y.TABET

Post Reply