Page 6 of 6

Re: HMG 3.0.25

Posted: Mon Dec 22, 2014 3:33 pm
by Pablo César
luisvasquezcl wrote:Roberto,
Muchas gracias.
Saludos cordiales y feliz navidad,
Luis Vásquez
Hola Luis,

Tenga en cuenta que esta cuestión se planteó aqui porque es una vieja demanda. El mensaje de nuestro gran maestro Roberto es antiguo (no hubo respuesta dél todavia). Te equivocaste en responder eso. :oops:

Saludos

Image

Hi Luis,

Please note that this issue was raised here because of an old demand. The message of our great master Roberto is since 2010 (no response from him yet). You were wrong in your answer that. :oops:

Rgds

HMG 3.0.25

Posted: Mon Dec 22, 2014 4:58 pm
by Pablo César
Pablo César wrote:
srvet_claudio wrote:See: C:\hmg.3.3.1\SAMPLES\Controls\Grid\GridOnKeyOnClick
Thank you Claudio ! I will try to adapt some but seems not easy. I wish to have characters key (only) to be inserted at edition. And also, I have no idea how to force for editing. I will try to insert virtual RETURN key to do it.
I got something which force editing:

_HMG_GRIDINPLACEKBDEDIT(i)

But I can not make the cell to cancel edition after lostfocus.

Re: HMG 3.0.25

Posted: Mon Dec 22, 2014 6:33 pm
by srvet_claudio
Pablo César wrote:
srvet_claudio wrote:See: C:\hmg.3.3.1\SAMPLES\Controls\Grid\GridOnKeyOnClick
Thank you Claudio ! I will try to adapt some but seems not easy. I wish to have characters key (only) to be inserted at edition. And also, I have no idea how to force for editing. I will try to insert virtual RETURN key to do it.
Pablo,
I do not understand what you want to do:
<ParentWindowName>.<GridControlName>.EditOption := GRID_EDIT_DEFAULT | GRID_EDIT_SELECTALL |
GRID_EDIT_INSERTBLANK | GRID_EDIT_INSERTCHAR |
GRID_EDIT_REPLACEALL

HMG 3.0.25

Posted: Mon Dec 22, 2014 6:40 pm
by Pablo César
Sorry, few words sometimes brings a lot of confusions too.

I based in the same code exemple you have suggested:

Code: Select all

#include "hmg.ch"

Function Main

public aRows [21] [3]

   aRows [1]   := {'Simpson','Homer','555-5555'}
   aRows [2]   := {'Mulder','Fox','324-6432'} 
   aRows [3]   := {'Smart','Max','432-5892'} 
   aRows [4]   := {'Grillo','Pepe','894-2332'} 
   aRows [5]   := {'Kirk','James','346-9873'} 
   aRows [6]   := {'Barriga','Carlos','394-9654'} 
   aRows [7]   := {'Flanders','Ned','435-3211'} 
   aRows [8]   := {'Smith','John','123-1234'} 
   aRows [9]   := {'Pedemonti','Flavio','000-0000'} 
   aRows [10]   := {'Gomez','Juan','583-4832'} 
   aRows [11]   := {'Fernandez','Raul','321-4332'} 
   aRows [12]   := {'Borges','Javier','326-9430'} 
   aRows [13]   := {'Alvarez','Alberto','543-7898'} 
   aRows [14]   := {'Gonzalez','Ambo','437-8473'} 
   aRows [15]   := {'Batistuta','Gol','485-2843'} 
   aRows [16]   := {'Vinazzi','Amigo','394-5983'} 
   aRows [17]   := {'Pedemonti','Flavio','534-7984'} 
   aRows [18]   := {'Samarbide','Armando','854-7873'} 
   aRows [19]   := {'Pradon','Alejandra','???-????'} 
   aRows [20]   := {'Reyes','Monica','432-5836'} 
   aRows [21]   := {'Fernández','two','0000-0000'} 

   FOR i = 1 TO 21
     AADD (aRows[i],str(i))
   NEXT

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 800 ;
      HEIGHT 650 ;
      TITLE "CELLNAVIGATION (F9 - On/Off)";
      MAIN 

      @  10, 10 Label Label_1 ;
         width 80;
         height 20;
         value "";
         autosize

      @  30, 10 Label Label_2 ;
         width 80;
         height 20;
         value "";
         autosize


      @ 80,10 GRID Grid_1 ;
         WIDTH 540 ;
         HEIGHT 500 ;
         HEADERS {'Last Name','First Name','Phone',"Num"} ;
         WIDTHS {140,140,140,50};
         ITEMS aRows ;
         VALUE 1;
         EDIT;
         ON CLICK OnClick();
         ON KEY OnKey();
         EDITOPTION GRID_EDIT_INSERTCHAR

         Form_1.Grid_1.ColumnCONTROL (4) := {"TEXTBOX", "NUMERIC",NIL,NIL}
         Form_1.Grid_1.ColumnJUSTIFY (4) := GRID_JTFY_RIGHT


aGridEditOptions := {GRID_EDIT_DEFAULT, GRID_EDIT_SELECTALL, GRID_EDIT_INSERTBLANK, GRID_EDIT_INSERTCHAR, GRID_EDIT_REPLACEALL}

         @ 80, 570 RADIOGROUP RadioGroup_1;
                   OPTIONS {"GRID_EDIT_DEFAULT", "GRID_EDIT_SELECTALL", "GRID_EDIT_INSERTBLANK", "GRID_EDIT_INSERTCHAR", "GRID_EDIT_REPLACEALL"}; 
                   VALUE 1;
                   WIDTH 200;
                   ON CHANGE Form_1.Grid_1.EditOption := aGridEditOptions [ Form_1.RadioGroup_1.VALUE ]

   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return



Function OnClick
   Form_1.Label_1.VALUE := "New  Row: "+ HB_NTOS(Form_1.Grid_1.CellRowClicked) + "   New  Col: "+ HB_NTOS(Form_1.Grid_1.CellColClicked) + "   --- ON CLICK ---"
   Form_1.Label_2.VALUE := "Last Row: "+ HB_NTOS(Form_1.Grid_1.CellRowFocused) + "   Last Col: "+ HB_NTOS(Form_1.Grid_1.CellColFocused) + "   --- ON CLICK ---"
Return NIL


Function OnKey
Local i:=GetControlIndex ("Grid_1","Form_1")
Local nKey:=HMG_GetLastVirtualKeyDown()

/*
   IF HMG_GetLastVirtualKeyDown() == VK_F9
      HMG_CleanLastVirtualKeyDown()
      Form_1.Grid_1.CellNavigation := .NOT. (Form_1.Grid_1.CellNavigation)
   ENDIF
   Form_1.Label_1.VALUE := "Row: "+ HB_NTOS(Form_1.Grid_1.CellRowFocused) + "   Col:"+ HB_NTOS(Form_1.Grid_1.CellColFocused) + "   --- ON KEY --- "
   Form_1.Label_2.VALUE := ""
   */
IF !(nKey == VK_RETURN .and. nKey == VK_ESCAPE)
   // _PushKey(VK_RETURN)
   _PushKey(nKey)
   _HMG_GRIDINPLACEKBDEDIT(i)
ENDIF
Return NIL
By this code, at first I need to insert character that have been typed and add to the existing contain of cell.