SavedMenuOption = MENU_OPTION_FROM_LINK (Link);\r
}\r
\r
- if (Link != NewPos || Index > BottomRow || (Link == NewPos && SavedMenuOption->Row + SavedMenuOption->Skip - 1 > BottomRow)) {\r
+ //\r
+ // Not find the selected menu in current show page.\r
+ // Have two case to enter this if:\r
+ // 1. Not find the menu at current page.\r
+ // 2. Find the menu in current page, but the menu shows at the bottom and not all info shows.\r
+ // For case 2, has an exception: The menu can show more than one pages and now only this menu shows.\r
+ //\r
+ // Base on the selected menu will show at the bottom of the page,\r
+ // select the menu which will show at the top of the page.\r
+ //\r
+ if (Link != NewPos || Index > BottomRow || \r
+ (Link == NewPos && (SavedMenuOption->Row + SavedMenuOption->Skip - 1 > BottomRow) && (Link != TopOfScreen))) {\r
//\r
// Find the MenuOption which has the skip value for Date/Time opcode. \r
//\r
if (SavedMenuOption->Row == 0) {\r
UpdateOptionSkipLines (Selection, SavedMenuOption);\r
}\r
- \r
+\r
+ //\r
+ // Base on the selected menu will show at the bottome of next page, \r
+ // select the menu show at the top of the next page. \r
+ //\r
Link = NewPos;\r
for (Index = TopRow + SavedMenuOption->Skip; Index <= BottomRow + 1; ) { \r
Link = Link->BackLink;\r
if (SavedMenuOption->Row == 0) {\r
UpdateOptionSkipLines (Selection, SavedMenuOption);\r
}\r
- Index += SavedMenuOption->Skip;\r
+ Index += SavedMenuOption->Skip;\r
}\r
- \r
- SkipValue = Index - BottomRow - 1;\r
- if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {\r
- TopOfScreen = Link;\r
- OldSkipValue = SkipValue;\r
+\r
+ //\r
+ // Found the menu which will show at the top of the page.\r
+ //\r
+ if (Link == NewPos) {\r
+ //\r
+ // The menu can show more than one pages, just show the menu at the top of the page.\r
+ //\r
+ SkipValue = 0;\r
+ TopOfScreen = Link;\r
+ OldSkipValue = SkipValue;\r
} else {\r
- SkipValue = 0;\r
- TopOfScreen = Link->ForwardLink;\r
+ //\r
+ // Check whether need to skip some line for menu shows at the top of the page.\r
+ //\r
+ SkipValue = Index - BottomRow - 1;\r
+ if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {\r
+ TopOfScreen = Link;\r
+ OldSkipValue = SkipValue;\r
+ } else {\r
+ SkipValue = 0;\r
+ TopOfScreen = Link->ForwardLink;\r
+ }\r
}\r
\r
Repaint = TRUE;\r