Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add buttons to _MESSAGEBOX function?
#1
The _MESSAGEBOX function has been a major improvement for me. Is there any way to add or change the default buttons? Being able to have buttons such as [Help] or [Quit] would be extremely useful. With the right buttons some of my utility programs wouldn't need any other type of GUI.
Reply
#2
You can make it return a 0 or 1 and get  Yes / No buttons with the following syntax.


        KillIt% = _MessageBox("FILE EXISTS", Z_File$ + " Exists\nOverwrite?", "yesno", "question", 0)
        If KillIt% = 1 Then
            Kill (Z_File$)
        Else
            Z_File$ = _InputBox$("NEW FILE NAME", "Enter ZCM File Name", Z_File$)
            If Z_File$ = "" Then System
            GoTo StartZWrite
        End If

I too would like the option for more buttons.   But you can do a lot with just a Yes/No option.
Reply
#3
+1 yes you can do allot with yes/no/cancel, cancel is 3rd option the one you never see in opinion polls ;-))

message box 1 do you want help? if yes then message box 2 offer help...

welcome @ahenry3068
b = b + ...
Reply
#4
Code: (Select All)

 KillIt% = _MessageBox("FILE EXISTS", Z_File$ + " Exists\nOverwrite?", "yesno", "question", 0)
The "\n" is a C/C++ control character and does not work in Basic.

All three options are better than just yes/no.
Code: (Select All)

KillIt% = _MessageBox("FILE EXISTS", Z_File$ + "Exist -- Overwrite?", "yesnocancel", "question", 2)
If KillIt% = 1 Then
  Kill (Z_File$)
Else
  Z_File$ = _InputBox$("NEW FILE NAME", "Enter ZCM File Name", Z_File$)
  If Z_File$ = "" Then System
  GoTo StartZWrite
End If

StartZWrite:
Print "Ende"
Reply
#5
You can try doing a TaskDialog. They are far more powerful than a standard MessageBox. However, they require a great deal of work. Here is a post I had submitted to the old forum website a long time ago.
https://qb64forum.alephc.xyz/index.php?t...#msg133688

However, be aware that the recent updates to Phoenix have broken a lot of older code I have written as they have changed the backend of some things. You will most likely need to do a lot of work to make it compatible with the recent versions.
Tread on those who tread on you

Reply




Users browsing this thread: 3 Guest(s)