使用图形安装程序&NSIS,当我动态更改标签时,标签的文本会重叠 [英] With in Graphical Installer & NSIS, the text of Label overlapped when I changed it dynamically

查看:23
本文介绍了使用图形安装程序&NSIS,当我动态更改标签时,标签的文本会重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个定制页面,其中包含一个标签和两个按钮来控制标签的内容。 我想在按钮的回调中设置标签的文本,代码如下:

Function FuncShowNewFeature
  ; ...
  ; Add Controls
 
  ${NSD_CreateLabel} 0 13u 100% 12u "Show new features here"
  Pop $lblContents
  ${GraphicalInstallerRedrawLabel} $lblContents
  
  ${NSD_CreateButton} 0 -13u 40u 13u "Prev"
  Pop $btnPrev
  ${NSD_OnClick} $btnPrev PrevFeature ; callback
  
  ${NSD_CreateButton} -40u -13u 40u 13u "Next"
  Pop $btnNext
  ${NSD_OnClick} $btnNext NextFeature ; callback
  
  # Put this macro before EACH calling nsDialogs::Show to draw background properly
  ${GraphicalInstallerRedrawnsDialogsPage}
  nsDialogs::Show
FunctionEnd

Function NextFeature
  ${NSD_SetText} $lblContents "To show the next tip of new-feature"
  ${GraphicalInstallerRedrawLabel} $lblContents ;I don't know whether this macro is necessary here
FunctionEnd

Function PrevFeature
  ${NSD_SetText} $lblContents "To show the previous tip of new-feature"
  ${GraphicalInstallerRedrawLabel} $lblContents ;I don't know whether this macro is necessary here
FunctionEnd

但结果显示有错误,新的";文本与旧的文本重叠,就像标签在重新绘制之前没有被刷新/清除一样。

在我的过程中是否错过了任何必要的调用?

推荐答案

您缺少GraphicalInstaller::SubclassLabel/NOUNLOAD$Variable_NAME

正确代码:

Function FuncShowNewFeature
  ; ...
  ; Add Controls
 
  ${NSD_CreateLabel} 0 13u 100% 12u "Show new features here"
  Pop $lblContents
  ${GraphicalInstallerRedrawLabel} $lblContents
  GraphicalInstaller::SubclassLabel /NOUNLOAD $lblContents # <<< ADDED HERE
  
  ${NSD_CreateButton} 0 -13u 40u 13u "Prev"
  Pop $btnPrev
  ${NSD_OnClick} $btnPrev PrevFeature ; callback
  
  ${NSD_CreateButton} -40u -13u 40u 13u "Next"
  Pop $btnNext
  ${NSD_OnClick} $btnNext NextFeature ; callback
  
  # Put this macro before EACH calling nsDialogs::Show to draw background properly
  ${GraphicalInstallerRedrawnsDialogsPage}
  nsDialogs::Show
FunctionEnd

Function NextFeature
  ${NSD_SetText} $lblContents "To show the next tip of new-feature"
FunctionEnd

Function PrevFeature
  ${NSD_SetText} $lblContents "To show the previous tip of new-feature"
FunctionEnd

GraphicalInstaller::Subclass[CONTROL]是以下项目的一部分 ${GraphicalInsteller Redraw[CONTROL]}宏。

这适用于类型为RadioButton或CheckBox的[控件],但标签中缺少它。

我们将在下一个版本中修复此问题,对此不一致深表歉意。

这篇关于使用图形安装程序&amp;NSIS,当我动态更改标签时,标签的文本会重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆