Is there any way to force a Display or refresh on a template?

Tags: #<Tag:0x00007f22536ced88>

Is there any way I can force a template to refresh the prompts on a template tab?

Situation is
Check box enables or disables a drop down & two prompts.
Drop down enables or disables first prompt <-- no longer a #Enable now a prop(Prop:Readonly) but this readonly function doesnt work either.
Prompt 1is Prop read only based on a group returning a value based on the above drop down
Prompt 2is the result of the above options.

The problem I’m seeing is the two prompts are not refreshing after any assignment using #clear or #set.

So is there anyway I can force a refresh on the prompts?

TIA

#Tab('&7 Link')
    #Display('')
    #Display('')
    #Prompt('Link',Check),%iscwLinkCheck,At(10),WhenAccepted(%grpWAtab7LinkCheck() )
    #Enable(%iscwLinkCheck)
    #Prompt('Project Define:',Drop('Own Project Define|_ABCLinkMode_')),%iscwLinkProjectDefine,Default('Own Project Define'),WhenAccepted(%grpWAtab7LinkProjectDefine() )
    #Prompt('Link Flag:',@s255),%iscwLinkFlag,Req,WhenAccepted(%grpWAtab7LinkFlag() ),Prop(Prop:ReadOnly,%grpFuncTab7LinkFlagReadOnly() )
    #Validate(%grpGVtab7LinkFlag(),'Check Tab 7: Link Flag')
    #Prompt('Link Declaration:',@s255),%iscwLinkDeclaration,Req,WhenAccepted(%grpWAtab7LinkDeclaration() )
    #Validate(%grpGVtab7LinkDeclaration(),'Check Tab 7: Link Declaration')
    #EndEnable
    #Display('If the class methods (procedures) are in a seperate .CLW')
    #Display('file, it needs to be linked in to the Project.')


#Group(%grpWAtab7LinkCheck)
#IF(%iscwLinkCheck = %False)
    #Set(%iscwLinkProjectDefine,'Own Project Define')
    #Set(%iscwLinkFlag,'')          #!Clearing value but not displaying a cleared prompt
    #Clear(%iscwLinkFlag)           #!Clearing value but not displaying a cleared prompt
    #Set(%iscwLinkDeclaration,'')   #!Clearing value but not displaying a cleared prompt
    #Clear(%iscwLinkFlag)           #!Clearing value but not displaying a cleared prompt
#EndIF

#Group(%grpWAtab7LinkProjectDefine)
#IF(%iscwLinkProjectDefine = '_ABCLinkMode_')
    #Set(%iscwLinkFlag,'_ABCLinkMode_')
#ElsIF(%iscwLinkProjectDefine = 'Own Project Define')
    #IF(%iscwLinkFlag = '_ABCLinkMode_')
        #Set(%iscwLinkFlag,'')  #!Clearing value but not displaying a cleared prompt
        #Clear(%iscwLinkFlag)   #!Clearing value but not displaying a cleared prompt
    #EndIF
#Else
    #Set(%iscwLinkFlag,'')  #!Clearing value but not displaying a cleared prompt
    #Clear(%iscwLinkFlag)   #!Clearing value but not displaying a cleared prompt
#EndIF

#Group(%grpWAtab7LinkFlag)
#Set(%iscwLinkDeclaration,'Link(''' & %iscwClassFilename &'.clw'',' & %iscwLinkFlag &')' )

#Group(%grpWAtab7LinkDeclaration)
#Set(%iscwLinkDeclaration,'Link(''' & %iscwClassFilename &'.clw'',' & %iscwLinkFlag &')' )


#Group(%grpFuncTab7LinkFlagReadOnly)
#IF(%iscwLinkProjectDefine = '_ABCLinkMode_')
    #Return %True
#Else
    #Return %False
#EndIF


#Group(%grpGVtab7LinkFlag)
#IF(%iscwLinkProjectDefine = 'Own Project Define')
    #IF(%iscwLinkFlag = '_ABCLinkMode_')
        #Set(%iscwLinkFlag,'')     #!Clearing value but not displaying a cleared prompt
        #Clear(%iscwLinkFlag)      #!Clearing value but not displaying a cleared prompt
        
        #Return %False
    #End
#ElsIF(%iscwLinkProjectDefine = '_ABCLinkMode_')
    #IF(%iscwLinkFlag = '_ABCLinkMode_')
        #Return %True
    #Else
        #Set(%iscwLinkFlag,'_ABCLinkMode_')
        #Return %True
    #EndIF
#Else
    #Return %False
#End


#Group(%grpGVtab7LinkDeclaration)
#Set(%iscwLinkDeclaration,'Link(''' & %iscwClassFilename &'.clw'',' & %iscwLinkFlag &')' )   #!Setting value but not displaying the value
#Return %True

You can try TplRefresh.

I see you are using InvalidateRect function (winuser.h) - Win32 apps | Microsoft Docs

did you try
UpdateWindow function (winuser.h) - Win32 apps | Microsoft Docs
or
RedrawWindow function (winuser.h) - Win32 apps | Microsoft Docs

or did you just go with this post ?

Anyway I’ll give TplRefresh a go and see if it works.

Thanks!

Edit.

If this works, you’ve given me a new idea for a way to extend the templates which will be nice. :grinning:

In my use case InvalidateRect does the job, but you can tweak the code for your needs. winapi and printf files can be found on my github.

I’ve just dropped the exe in and modified my template here and its not refreshing the template, so I’ll have to go through the source and see whats going on that way.

TplRefresh fixes template engine bug when list content changed but not refreshed automatically. Maybe your case is the #prompt content changes applied only after OK pressed.

yeah, its my #prompt 's which are not refreshing so I’m just expanding this, plus I want to call it from #RunDll so I’m rehashing it a bit.

I’ll post it to github when its done.

Have you ever seen this error message?
Make Error: No compiler known for file printf.inc (unknown extension)

There is no space after the filename extension .inc and I’ve loaded printf.inc into notepad++ to see if there were any characters not being shown in clarion, ie the CR LF etc types and it all looks ok.

Where is your Winapi.inc file, I tried search github and it couldnt find anything and now it wants me to sign up, which I’m not doing yet as it kept injecting stuff into my clipboard on my pc.

Use “Code” button (green on the right) then “Download ZIP” option.

winapi
printf

I found the printf repository but couldnt find your winapi repository, anyway I’ve got it now I’ll give this a go in a short while. Thanks!