Создание Эльфов : Эльфостроение : Форум

Страница 76 из 211: « 1 ... 72 73 74 75 [76] 77 78 79 80 ... 211 »

 arban:
31.12.08, 19:36
 Peti, he use KeyHook too =)

 Peti:
01.01.09, 23:19
 I'm trying to get which item is selected in menu. This gives me a white screen of death. Does anyone have an idea how to get it working?
Код: 

int main(wchar_t *elfname, wchar_t *path, wchar_t *fname)
{
  ...
  ModifyKeyHook(KeyHook,1);
}

...

int KeyHook(int key, int r1 , int mode)
{
  wchar_t temp[256];
  if (key!=KEY_CAMERA_FOCUS || mode!=KBD_SHORT_PRESS) return(0);
  if(DISP_OBJ* dobj=DISPBASE_GetFocused(0))
  {
    if(char* name=DISP_OBJ_GetName(dobj))
    {
      if(UI_APP_SESSION *apsess=root_list_get_session(root_list_get_session_count()-1))
      {
        BOOK *book=SESSION_GetTopBook(apsess);
        if(!strcmp(book->xbook->name,"MenuBook"))
        {
          wchar_t*name_buf=MenuBook_Desktop_GetSelectedItemID(book);
          MessageBox(0x6FFFFFFF, Str2ID(name_buf,0,SID_ANY_LEN), 0xFFFF, 1, 0, 0);
        }
        else
        {
          snwprintf(temp, MAXELEMS(temp), _T("book:%s\ngui:%s"),book->xbook->name, name);
          MessageBox(0x6FFFFFFF, Str2ID(temp,0,MAXELEMS(temp)), 0xFFFF, 1, 0, 0);
        }
      }
    }
  }
  return (0);
}


 jonico:
02.01.09, 00:02
 
Код: 
BOOK * mybookMenu = SESSION_GetTopBook(root_list_get_session(root_list_get_session_count() - 1));
      if (!strcmp(mybookMenu->xbook->name,NameMenu))     
      {
        wchar_t * mywstr = MenuBook_Desktop_GetSelectedItemID(mybookMenu);
        int len = wstrlen(mywstr);
        if(
            (!wstrncmp(mywstr, L"OperatorWebPage", len)) ||
            (!wstrncmp(mywstr, L"InternetServices", len)) ||
            (!wstrncmp(mywstr, L"Entertainment", len)) ||
            (!wstrncmp(mywstr, L"Camera", len)) ||  
            (!wstrncmp(mywstr, L"Messaging", len)) ||  
            (!wstrncmp(mywstr, L"MediaPlayer", len)) || 
            (!wstrncmp(mywstr, L"FileManager", len)) ||  
            (!wstrncmp(mywstr, L"Phonebook", len)) || 
            (!wstrncmp(mywstr, L"FMRadio", len)) ||  
            (!wstrncmp(mywstr, L"Calls", len)) ||  
            (!wstrncmp(mywstr, L"Organizer", len)) || 
            (!wstrncmp(mywstr, L"Settings", len)) || 
            (!wstrncmp(mywstr, L"Alarms", len)) || 
            (!wstrncmp(mywstr, L"PlayNow", len))  
          )       


This is Myrzeug's code. it works but not perfect.

 Peti:
02.01.09, 00:13
 Oh now I get it. My code works perfectly IF it is not a flash menu. :-x

 myrzeug:
02.01.09, 02:34
 
jonico пишет:
This is Myrzeug's code. it works but not perfect.

It works perfect!

 Peti:
02.01.09, 03:00
 And mine too but only with non-flash menus. Flash menu is drawn as image and the browser handles it, not possible to handle with these methods. But I found my very own solution. 8-)

 jonico:
02.01.09, 06:34
 peti if you can i wanna see your code.
Myrzeug: when we have an item with the name Calls (in example) in a submenu, then is when is a not perfect method to identify Menubook.

 Peti:
02.01.09, 16:13
 The solution I mentioned?

 jonico:
02.01.09, 19:38
 yes please.

 Peti:
02.01.09, 20:55
 I wanted to catch Walkman when it starts. If walkman book starts up from menu, I kill it and do what I want.
Код: 

u16 timer;
int hits;
int max_tries;

...
ModifyKeyHook as usual
...

int KeyHook(int key, int r1 , int mode)
{
  if (!(key==KEY_ENTER || key==KEY_LEFT_SOFT || key==KEY_DIGITAL_0+6)) return(0);
  menubooks=0; FindBook(MenuBooks);
  if(menubooks==1)
  {
    if (timer)
    {
      Timer_Kill(&timer);
      timer=0;
    }
    timer=Timer_Set(10,onTimer,0);
    hits=0;
  }
  return (0);
}

void onTimer (u16 timerID, LPARAM n)
{
  BOOK * book;
  menubooks=0; FindBook(MenuBooks);
  if ((book=FindBook(isAudioPlayerBook())) && menubooks==1)
  {
    FreeBook(book);
    hits=0;
    timer=0;
    CreateMyGui(NULL,(BOOK*)myBook);
  }
  else
  {
    hits++;
    if (hits<=max_tries)
      Timer_ReSet(&timer,100,onTimer,0);
  }
}

int MenuBooks(BOOK * struc)
{
  if (!strcmp(struc->xbook->name,"MenuBook"))
  {
    menubooks++;
  }
  return(0);
}

Does not work flawlessly though. It kill walkman if I press walkman key in organizer menu and such problems. ;-)


Added 7.1.09 17:37

Is there any way to:
a) create a gui that is on full screen, like image viewer
b) draw on a gui like walkman does. see, walkman is basically a ListObject, the walkman is drawn over it; when I set onredraw for it, the songs' list gets different, the walkman remains the same
Is there any lib function to do either of them?
Страница 76 из 211: « 1 ... 72 73 74 75 [76] 77 78 79 80 ... 211 »

URL этой темы:
https://mobilefree.justdanpo.ru/newbb_plus/viewtopic.php?topic_id=2479&start=750

© 2005-2018 supertrubka.org