いくつかのCustomButtonを追加したVerticalFieldmanageroptFieldManagerを作成しました。次に、touch eventメソッドを使用してボタンの機能を呼び出したいです。TouchEvent()メソッドを使用してこれを試しました。このために、インデックス値を0として与えるoptFieldManagerのインデックスをフェッチします。これにより、フィールドが存在することが確認されますが、マネージャー内で-1の値を返すフィールドを再度要求します。これは、マネージャーにフィールドが追加されていないことを意味します...これは正しくありません。コードをデバッグしたところ、クリックされた位置が見つかりました。正しく返される
int index1=optionVertFldMgr.getFieldAtLocation(message.getX(1), message.getY(1));
しかし、index1の値は-1になりますが、これは間違っています
どうしたの
以下にコードスニペットを追加しました
protected boolean touchEvent(TouchEvent message) {
switch(message.getEvent())
{
case TouchEvent.CLICK:
{
int index=getFieldAtLocation(message.getX(1), message.getY(1));
//int index1=optionVertFldMgr.getFieldAtLocation(message.getX(1), message.getY(1));
if(index!=-1)
{
Field field=getField(index);
if(field.equals(optionVertFldMgr))
{
int index1=optionVertFldMgr.getFieldAtLocation(message.getX(1), message.getY(1));
System.out.println("HELOOOOOOO"+((VerticalFieldManager) field).getFieldAtLocation(message.getX(1), message.getY(1)));
//int index1=optionVertFldMgr.getFieldWithFocusIndex();
if(index1>-1)
{
Field fld=optionVertFldMgr.getField(index1);
if(fld.equals(m_agendaBtn))
{
fld.setFocus();
return true;
}else if(fld.equals(m_eventFeedBackBtn))
{
fld.setFocus();
UiApplication.getUiApplication().pushScreen(new EventFeedbackScreen());
return true;
}
}
}
}
}
}
return false;
}