Possible to Rename WIL Button Labels

Started by KeithW, December 30, 2024, 02:15:23 PM

Previous topic - Next topic

KeithW

Greetings,

I have an app that I would like to re-label some some WIL Function buttons, change an OK to something else or a Cancel to Exit, etc... is it possible to do this?  I am NOT looking to change the actual functionality, this
is strictly a cosmetic issue.

Regards,
Keith

spl

If you are referring to WIL functions like AskFileName(), or any type of message boxes I believe the answer is likely no. You could re-design your own with CLR/Windows.Forms, or WIL dialogs, but that is outside the scope of your ask.
Stan - formerly stanl [ex-Pundit]

kdmoyers

Maybe check out the ButtonNames function?
The mind is everything; What you think, you become.

JTaylor

Interesting.   Don't recall ever seeing that Function before.

jim

td

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kdmoyers

I am a voracious reader of the release notes. 🙂
The mind is everything; What you think, you become.

spl

Quote from: kdmoyers on January 02, 2025, 07:35:02 AMI am a voracious reader of the release notes. 🙂

Good find. Saw the 2014 post where Deana mentioned that. 
Stan - formerly stanl [ex-Pundit]

cssyphus

Further to Kirby's suggestion (which I had forgotten about also), there are some limitations to it:

Note: Buttonnames does not change the name in all functions which display buttons. Supported functions are: AskLine, AskFileText, AskItemList, AskPassword.


But you can also check out some user-created solutions:

IFICANTBYTE's WSHMessage UDF

Sean Dorn's UDF Replacement For Message (I use this one all the time...)

**Links:
https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/UDF~-~UDS~Library/Dialog~Boxes+WSHMessage~UDF.txt

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/UDF~-~UDS~Library/Dialog~Boxes+UDF~Replacement~for~Message.txt

KeithW

ButtonNames would be a winner is it only supported more functions...
unfortunately is does not modify AskFileName which is really where I wanted it.

We should have a ButtonNames for ALL 2 button functions and a ButtonNames3 for
3 button dialogs... would be really cool to customize the naming for the application
of the dialog.

Oh, so close...

Keith

snowsnowsnow

Contrary to what has been posted here, it is entirely possible to do this and I do it "all the time".

No, it doesn't involve writing a custom Dialog(); it uses the built-in functions, such as AskYesNo().  It just involves a little trickery with the Control Manager extender.  And, yes, I too found ButtonNames() to be a little weird, in that it promises much, but delivers little (since it is limited as to which functions it works with). I've often wondered *why* that particular subset...

Anyway, here is demo program for my udsAskYesNo() - a (almost) drop in replacement for AskYesNo():

; Start of script

IF "%Param1%" == "-fixbuttons"
    AddExtender("wwctl44i.dll")
    window1 = DllHwnd(Param2)
    cSetWndText(cWndByID(window1,6),Param3)
    cSetWndText(cWndByID(window1,7),Param4)
    cSetWndText(cWndByID(window1,2),Param5)
    Exit
ENDIF

#DefineSubroutine udsAskYesNo1(a,b,c,d,e)
RunHide(Prog,'-fixbuttons "%a%" %c% %d% %e%')
Return AskYesNo(a,b)
:CANCEL
Return -1
#EndSubroutine

IF !IsDefined(Prog) THEN Prog = IntControl(1004,0,0,0,0)
ProgDate = StrCat(Prog," - ",FileTimeGet(Prog))

Pause("Result:",udsAskYesNo1("Save position, Delete file, or exit","This is only a test","&SavePosition","&DeleteFile","&JustStop"))


The idea is that the new function takes 5 args - the first 2 are passed to the usual AskYesNo() as is; the last three are the new names for the buttons, with the & specificying as usual the "hotkey" for that button.

By the way, I put the above in a "code" block, but it doesn't syntax highlight.  Is it still possible to do that and if so, how?

spl

Quote from: snowsnowsnow on January 04, 2025, 05:39:07 AMContrary to what has been posted here, it is entirely possible to do this and I do it "all the time".

Agree. And I referenced a post you finalized in 2014. Looking at ButtonNames, in my archives I found scripts from 2002 where I used the function. True, we all moved forward from 2002 and also true, the Op's request was merely 'cosmetic'. So, perhaps we close this thread as a flash from the past.
Stan - formerly stanl [ex-Pundit]

snowsnowsnow

QuoteAnd I referenced a post you finalized in 2014.

I must have missed that.  Can you point me to the referenced post?  Thanks.

And, also, as a total aside, but it is actually pretty important to me, can anyone tell me if/how to get WB code syntax-highlighted on this board?  I know it used to work...

td

The forum's syntax coloring extension is not compatible with the current version of SMF. Integrating it into the new version's source code is time-consuming.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

snowsnowsnow

Yeah, I thought it was something like that.

Are there workarounds?  I.e., is it possible to do your own highlighting (say with "VIM" - my editor of choice) and then cut-and-paste the result into the forum?

Maybe I will do some experimenting along those lines...

td

The forum has many restrictions on HTML in posts for obvious security reasons. It might be possible to simulate HTML using BBC markup. I have a WinBatch Studio menu script that worked on the old Webboard before moving the forum to the first version of SMF. I have yet to determine whether or not it works with the current version of SMF.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

KeithW

SNOWSNOWSNOW,

Exactly what I wanted to do, sorry others think that COSMETIC changes are not as "important"
when you are writing a script for someone else you want to use their terminology if possible
to help them with the process they are doing.  That is why I asked and I DID NOT know or find
a thread from 2002 or any other year that addressed my issue, probably because I did not use
the correct search term, otherwise I would have never posted in the first place.  Now if I
can get this working for the function I wanted it for, it will be perfect.

Thanx for the basis of the solution !!

Keith


Quote from: snowsnowsnow on January 04, 2025, 05:39:07 AMContrary to what has been posted here, it is entirely possible to do this and I do it "all the time".

No, it doesn't involve writing a custom Dialog(); it uses the built-in functions, such as AskYesNo().  It just involves a little trickery with the Control Manager extender.  And, yes, I too found ButtonNames() to be a little weird, in that it promises much, but delivers little (since it is limited as to which functions it works with). I've often wondered *why* that particular subset...

Anyway, here is demo program for my udsAskYesNo() - a (almost) drop in replacement for AskYesNo():

; Start of script

IF "%Param1%" == "-fixbuttons"
    AddExtender("wwctl44i.dll")
    window1 = DllHwnd(Param2)
    cSetWndText(cWndByID(window1,6),Param3)
    cSetWndText(cWndByID(window1,7),Param4)
    cSetWndText(cWndByID(window1,2),Param5)
    Exit
ENDIF

#DefineSubroutine udsAskYesNo1(a,b,c,d,e)
RunHide(Prog,'-fixbuttons "%a%" %c% %d% %e%')
Return AskYesNo(a,b)
:CANCEL
Return -1
#EndSubroutine

IF !IsDefined(Prog) THEN Prog = IntControl(1004,0,0,0,0)
ProgDate = StrCat(Prog," - ",FileTimeGet(Prog))

Pause("Result:",udsAskYesNo1("Save position, Delete file, or exit","This is only a test","&SavePosition","&DeleteFile","&JustStop"))


The idea is that the new function takes 5 args - the first 2 are passed to the usual AskYesNo() as is; the last three are the new names for the buttons, with the & specificying as usual the "hotkey" for that button.

By the way, I put the above in a "code" block, but it doesn't syntax highlight.  Is it still possible to do that and if so, how?


spl

Quote from: KeithW on January 06, 2025, 01:07:00 PMsorry others think that COSMETIC changes are not as "important"

That was a cheap shot.
Stan - formerly stanl [ex-Pundit]

KeithW

Quote from: spl on January 06, 2025, 01:23:31 PM
Quote from: KeithW on January 06, 2025, 01:07:00 PMsorry others think that COSMETIC changes are not as "important"

That was a cheap shot.

Sorry you took it that way, your post came across as dismissive.  I was trying to learning something and all you wanted was to close this thread.  I do not get to spend unlimited time with or on WinBatch and feel like I have to start over due to the time between. Nothing says you have to comment if you think it is beneath you.

Keith