Hi all.
I'm trying to implement a search box "universal" for all section.
Name:  Screenshot - 20_02_2015 , 09_02_21.jpg
Views: 286
Size:  19.2 KB
Name:  Screenshot - 20_02_2015 , 09_03_09.jpg
Views: 285
Size:  31.5 KB

I can create the various controls, but I have a problem, when I press the "search" button, how can I do riferiemnto the values set in the combobox?

this is the code:
Code:
//////////////////////////////////////////////////////////////////////////////
proc sem_AddSectionSearchPanel(psTable)
//////////////////////////////////////////////////////////////////////////////

	sp_container = createObject("container")
	sp_container.addObject("osp_combo", "Combobox")
	sp_combo = osp_combo
	osp_combo.move(5, 3, 80, 20)
		
	select(psTable)
	
	afields(laAllFields)
	for lnI = 1 to alen(laAllFields, 1)
		osp_combo.additem(laAllFields(lnI, 1))
	endfor

	sp_container.addObject("osp_comboCondition", "Combobox")
	sp_comboCondition = osp_comboCondition
	osp_comboCondition.move(85, 3, 80, 20)
	
	select(psTable)
	
	osp_comboCondition.additem("Uguale")
	osp_comboCondition.additem("Maggiore di")
	osp_comboCondition.additem("Minore di")
	osp_comboCondition.additem("Compreso")
	osp_comboCondition.additem("Contenente")

	sp_container.addObject("osp_textbox", "textbox")
	sp_textbox = osp_textbox
	sp_textbox.tooltip = psTable
	osp_textbox.move(165, 3, 100, 20)
	sp_container.addObject("sp_search", "commandbutton")
	sp_search.move(270, 3, 60, 20)
	sp_search.text = "Search"
	sp_search.click = sp_search_handler
	sp_search.tooltip = psTable
	sp_container.addObject("sp_clear", "commandbutton")
	sp_clear.move(335, 3, 60, 20)
	sp_clear.text = "Reset"
	sp_clear.click = sp_reset_handler 
	this.addSearchPanel(sp_container)
endproc

////////////////////////////////////////////////////////////////
// handlers for the Search Panel
proc sp_search_handler()
////////////////////////////////////////////////////////////////
	private sp_mainTable, sp_comboCondition, sp_combo, sp_textbox
	sp_mainTable = ""
	sp_comboCondition = ""
	sp_combo = ""
	sp_textbox = ""
	
	oActivePage = lianja.activepage
	ActicePage = oActivePage.id
	oActiveSection = Lianja.get(ActicePage).activesection
	
	? oActiveSection.caption
	
	sp_mainTable = oActiveSection.table
	
	? "sp_search_handler psTable" + sp_mainTable
	local m_search
	
	? this.parent()
	
	m_search = dd_search_handler(sp_mainTable, sp_comboCondition, sp_combo, sp_textbox)		
	lianja.get(sp_mainSection).sql = m_search
	Lianja.getElementById(sp_mainSection).filter = ''
		
endproc
In the search handler, is possible to refers to the combobox declared in AddSectionSearchPanel procedure?

thanks
Fabio