PowerBuilder预处理指令和DEBUG不起作用。

huangapple go评论74阅读模式
英文:

Powerbuilder preprocessor directive and DEBUG not working

问题

I'm having some buggy behavior with DEBUG and precompiler directives.

我在DEBUG和预编译指令方面遇到了一些问题。

I have a PowerBuilder application. In the production environment it logs in using a certificate, but in Dev, to make things easier on myself I want to login with username and password. I added this bit of code:

我有一个PowerBuilder应用程序。在生产环境中,它使用证书进行登录,但在开发环境中,为了让自己更容易,我希望使用用户名和密码登录。我添加了这段代码:

#if defined DEBUG then
MessageBox("Info","Running in DEBUG mode, certificates disabled!")
ibool_certlogin = FALSE
#else
ibool_certlogin = TRUE
#end if

This seems to only work sometimes. When I first load the project, and run it it fails. Meaning, even though I'm in the IDE and DEBUG should be defined, the message box still does not display, and the certificates are still enabled.

这似乎只在某些情况下有效。当我首次加载项目并运行时,它会失败。这意味着,即使我在IDE中,DEBUG应该已定义,消息框仍然不会显示,并且证书仍然处于启用状态。

I can however correct the behavior with a somewhat arbitrary change. Specifically, if I open the module this code is in, and then arbitrarily type a space, and then save. Then I run the project the message box correctly displays and the certificates are correctly disabled. It continues to function correctly until I close PowerBuidler IDE and reopen it.

但是,我可以通过进行某种程度上的任意更改来纠正这种行为。具体来说,如果我打开包含此代码的模块,然后随意键入一个空格,然后保存。然后运行项目,消息框将正确显示,证书将正确禁用。它会继续正确运行,直到我关闭PowerBuilder IDE并重新打开它。

Has anyone experience this or know a solution?

有人经历过这个问题或者知道解决方法吗?

英文:

I'm having some buggy behavior with DEBUG and precompiler directives.

I have a PowerBuilder application. In the production environment it logs in using a certificate, but in Dev, to make things easier on myself I want to login with username and password. I added this bit of code:

#if defined DEBUG then
   MessageBox("Info","Running in DEBUG mode, certificates disabled!")
   ibool_certlogin = FALSE
#else
   ibool_certlogin = TRUE
#end if

This seems to only work sometimes. When I first load the project, and run it it fails. Meaning, even though I'm in the IDE and DEBUG should be defined, the message box still does not display, and the certificates are still enabled.

I can however correct the behavior with a somewhat arbitrary change. Specifically, if I open the module this code is in, and then arbitrarily type a space, and then save. Then I run the project the message box correctly displays and the certificates are correctly disabled. It continues to function correctly until I close PowerBuidler IDE and reopen it.

Has anyone experience this or know a solution?

答案1

得分: 0

我相信如果在指令中进行更改,需要重新构建项目,仅仅运行是不够的。

如果您需要在从IDE运行时获得特定行为,一个更简单的解决方案是:

IF handle(getapplication()) = 0 THEN
    // 从IDE运行
    ...
ELSE
    // 从可执行文件运行
END IF
英文:

I believe that you need to rebuild the project if you make a a change in a directive, a simple run is not enough.

A simpler solution if you need a specific behaviour when running from the IDE is :

IF handle(getapplication()) = 0 THEN
    // running from the IDE
    ...
ELSE
    // running from EXECUTABLE
END IF

huangapple
  • 本文由 发表于 2023年8月11日 01:39:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76878121.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定