我想将每个文本框中的字符数限制为4位。
它可以在C#Winform中实现,但是不熟悉如何在NSIS中使用它。
尝试的操作:
我贴上标签,然后将输入引导至四位数。
但这不好。
我试图通过NSIS论坛查找信息,但是找不到。
附加文本框图像:
NSIS代码:
import org.springframework.cloud.contract.verifier.messaging.MessageVerifier;
import org.springframework.context.ApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.support.converter.MessagingMessageConverter;
import org.springframework.messaging.Message;
import javax.jms.JMSException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class ActiveMqStubMessages implements MessageVerifier<Message<?>> {
private final ApplicationContext applicationContext;
public ActiveMqStubMessages(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public void send(Message message, String destination) {
throw new UnsupportedOperationException();
}
@Override
public <T> void send(T payload, Map<String, Object> headers, String destination) {
throw new UnsupportedOperationException();
}
@Override
public Message<?> receive(String destination, long timeout, TimeUnit timeUnit) {
final JmsTemplate jmsTemplate = applicationContext.getBean(JmsTemplate.class);
final long originalReceiveTimeout = jmsTemplate.getReceiveTimeout();
try {
jmsTemplate.setReceiveTimeout(TimeUnit.MILLISECONDS.convert(timeout, timeUnit));
return (Message) new MessagingMessageConverter().fromMessage(jmsTemplate.receive(destination));
} catch (JMSException e) {
throw new RuntimeException(e);
} finally {
jmsTemplate.setReceiveTimeout(originalReceiveTimeout);
}
}
@Override
public Message<?> receive(String destination) {
return receive(destination, 3, TimeUnit.SECONDS);
}
}
NSIS INI文件:
Function Test
!insertmacro MUI_INSTALLOPTIONS_READ $0 "pageInputLicenseInfo.ini" "Settings" "State"
${If} $0 == 9 # btton
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "pageInputLicenseInfo.ini" "Field 1" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "pageInputLicenseInfo.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R2 "pageInputLicenseInfo.ini" "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R3 "pageInputLicenseInfo.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R4 "pageInputLicenseInfo.ini" "Field 5" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R5 "pageInputLicenseInfo.ini" "Field 6" "State"
nsExec::ExecToStack '$INSTDIR\ParamterTestConsole.exe ${PRODUCT_NAME} $R0 $R1$R2$R3$R4$R5'
Pop $2 ; Exit code
Pop $3 ; console OUTPUT
Blah blah..........
FunctionEnd
请帮助我。
答案 0 :(得分:0)
如documentation中所述,您可以使用MaxLen
选项。
示例:
[Field 1]
Type=Text
Text=1
Left=29
Right=275
Top=46
Bottom=57
MaxLen=4