How to implement search screen in Panel

How to implement search screen in Panel in my application roKeyboardScreen is working fine in main.brs. but am using in panel(extends = panel) its crashed at screen.SetMessagePort(port)

screen = CreateObject(“roKeyboardScreen”)
port = CreateObject(“roMessagePort”)
screen.SetMessagePort(port)

Please help me I was strucked from last 3 days

what’s the crash output?
probably you have to move this to happen in a task?