ComboSearchGrid

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5256
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 167 times
Been thanked: 169 times
Contact:

Re: ComboSearchGrid

Post by Rathinagiri » Sat Aug 22, 2015 4:28 am

Can I know your windows version?

Can you give a small sample?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 8:56 am

windows 8.1
executive windows 7 the same happens.
csgood.ZIP -THIS IS EXAMPLE WHEN DOING WELL WHEN NO INITIAL VALUES
csNOgood.ZIP -THIS IS EXAMPLE WHEN DOING WELL WHEN INITIAL VALUES
Attachments
CSGOOD.ZIP
(1.92 MiB) Downloaded 138 times

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 9:00 am

This is an example IF NOT DOING WELL . When entered VALUE Syntax

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 9:05 am

This is an example IF NOT DOING WELL . When entered VALUE Syntax

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 9:05 am

This is an example IF NOT DOING WELL . When entered VALUE Syntax

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 9:09 am

This is an example IF NOT DOING WELL . When entered VALUE Syntax
Function p1
LOCAL proba:="A" ****DEFINE HOME VALUE

Public aItems := {}
aItems := AgendaOpen()

DEFINE WINDOW CSG AT 10, 20 ;
WIDTH 500 HEIGHT 600 ;
modal ;
nosize ;
nosysmenu ;
TITLE 'ComboSearchGrid - Sample'

DEFINE LABEL namelabel
ROW 10
COL 10
WIDTH 60
VALUE 'Name'
END LABEL

DEFINE COMBOSEARCHGRID NAME
ROW 10
COL 80
WIDTH 600
VALUE proba **** ASK VALUE COMBOSEARCHGRID
ITEMS aItems
HEADERS { 'Sifra' , 'Ime' }
WIDTHS { 300 , 170 }
JUSTIFY { 0 , 0 }
anywheresearch .t.
showheaders .t.
END COMBOSEARCHGRID


DEFINE LABEL label2
ROW 40
COL 10
WIDTH 60
VALUE 'Label 2'
END LABEL

DEFINE TEXTBOX textbox2
ROW 40
COL 80
WIDTH 200
END TEXTBOX

DEFINE BUTTON Selection
ROW 70
COL 10
WIDTH 200
CAPTION 'Click after selecting an item'
ACTION findselecteditem()
END BUTTON

END WINDOW

CSG.CENTER
CSG.ACTIVATE
Return Nil

User avatar
Rathinagiri
Posts: 5256
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 167 times
Been thanked: 169 times
Contact:

Post by Rathinagiri » Sat Aug 22, 2015 9:45 am

Hi,

Please try this...

Code: Select all

#include 'hmg.ch'
#include 'hfcl_combosearchgrid.ch'

Function p1
LOCAL proba:="A"
Public aItems := {}
aItems := AgendaOpen()	

    DEFINE WINDOW CSG  AT 10, 20                 ;
                       WIDTH  500  HEIGHT  600 ;
                          modal                           
               	
      DEFINE LABEL namelabel
             ROW    10
             COL    10
             WIDTH  60
             VALUE  'Name'         
      END LABEL
      
      DEFINE COMBOSEARCHGRID NAME
         ROW      10
         COL      80
         WIDTH   600
         ITEMS   aItems
//         value proba
         HEADERS { 'Sifra' , 'Ime' }
         WIDTHS  {   300  ,   170  }
         JUSTIFY {     0  ,     0  }
         anywheresearch .t.
         showheaders .t.
      END COMBOSEARCHGRID
      
      
      DEFINE LABEL label2
         ROW   40
         COL   10
         WIDTH 60
         VALUE 'Label 2'
      END LABEL
      
      DEFINE TEXTBOX textbox2
         ROW    40
         COL    80
         WIDTH 200
      END TEXTBOX
      
      DEFINE BUTTON Selection
         ROW      70
         COL      10
         WIDTH   200
         CAPTION 'Click after selecting an item'
         ACTION  findselecteditem()
      END BUTTON
      
   END WINDOW
   StopControlEventProcedure( 'name', 'csg', .t. )
   csg.name.value := proba
   StopControlEventProcedure( 'name', 'csg', .f. )
   CSG.CENTER
   CSG.ACTIVATE
Return Nil   
 

/******************************************/
Function findselecteditem()
/******************************************/
   local aData := {}
   local i     := 0
   local cMsg  := ''
   aData       := _HMG_CSG_ItemSelected( 'CSG', 'NAME' )
   if len( aData ) > 0
      cMsg := '{'
      for i := 1 to len( aData )
         cMsg := cMsg + aData[ i ] 
         if i < len( aData )
            cMsg := cMsg + ', ' 
         endif
      next i
      cMsg := cMsg + '}'
      msginfo( 'You have selected the item - ' + cMsg )
   endif
Return Nil

/******************************************/   
Function AgendaOpen()
/******************************************/
    local i := 0
    local aItems1 := {}
	Use AGENDA Alias Agenda2 new shared
	If ! File( 'Agenda2.ntx' )
	       Index on Nome  to Agenda2
	Endif
	Agenda2->( DBCLearIndex()         )
	Agenda2->( DBSetIndex( 'Agenda2') )
	Agenda2->( DbGotop()              )
	Agenda2->( DbSkip()               )
	
	WHILE ! Agenda2->( Eof() )
	  i ++
      aadd( aItems1 , { ALLTRIM( Agenda2->CODIGO) , Agenda2->NOME } )
      *MSGBOX(aItems1[ i ] [ 2 ])
      Agenda2->( dbSkip() )
      
   ENDDO
   

Return  aItems1
/*
*/
   
  
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 10:14 am

So doing , I need to set the initial value . I use it when selecting from the codebook . Not a problem when a new record is concerned. The problem arises when you need to correct the value of the selected item

Thank you.

User avatar
Rathinagiri
Posts: 5256
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 167 times
Been thanked: 169 times
Contact:

Post by Rathinagiri » Sat Aug 22, 2015 11:38 am

When you correct an item, you have to use the update feature.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

zorpavns
Posts: 20
Joined: Tue Apr 23, 2013 10:43 am
DBs Used: DBF
Location: Novi Sad, Serbia

Post by zorpavns » Sat Aug 22, 2015 12:02 pm

I have to show the old value to the user know what is typed . Obviously the problem in the opening window. When it enters the initial value , get information about the active window . Do not open a new window already displays a textbox based on the first window. The second window does not open . When using the MAIN window everything is working properly. But when used MODAL then dabbles

Post Reply