我有一个应用程序,它使用ArrayList(listOne)的输入来创建Component条目。
有一次,我想用第二个ArrayList中的元素重新填充sidemenu(listTwo,实际上是listOne的一个修改)。
我的问题是两个列表中的项目都显示在侧面菜单中。
如何刷新侧面菜单,以便只显示新列表的项目?
任何帮助都将不胜感激。
这是我到目前为止所做的:
tb = hi.getToolbar();
for (String s : listOne) {
testLabel = new Label(s);
tb.addComponentToSideMenu(testLabel);
}
public void test () {
tb.remove();
tb.removeAll();
tb.removeComponent(testLabel);
testLabel.remove();
for (String string : listTwo) {
testLabel = new Label(string);
tb.addComponentToSideMenu(testLabel);
}
}
答案 0 :(得分:1)
我找到了一种方法,但我不知道,如果它是理想的:
[Files]
Source: InnoCallback.dll; Flags: dontcopy
[Code]
type
TTimerProc = procedure(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
function SetTimer(hWnd: longword; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord):
LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;
external 'KillTimer@User32.dll stdcall';
function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
external 'wrapcallback@files:innocallback.dll stdcall';
var
AnimationTimer: LongWord;
procedure AnimationTimerProc(
H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
var
L: Integer;
begin
L := WizardForm.MainPanel.Left - ScaleX(5);
if L < 0 then
begin
L := 0;
KillTimer(0, AnimationTimer);
end;
WizardForm.MainPanel.Left := L;
end;
procedure CurPageChanged(CurPageID: Integer);
var
HoverTimerCallback: LongWord;
begin
if CurPageID = wpReady then
begin
HoverTimerCallback := WrapTimerProc(@AnimationTimerProc, 4);
AnimationTimer := SetTimer(0, 0, 5, HoverTimerCallback);
WizardForm.MainPanel.Left := WizardForm.MainPanel.Width;
end;
end;