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
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
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.
The noticing will continue
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to add a Poll to a Thread Magdha 2 166 02-10-2026, 05:38 PM
Last Post: Magdha
Star Suggestion for new REPLACE$() function zaadstra 3 238 01-26-2026, 05:11 PM
Last Post: grymmjack
  Is there a menu function? Mad Axeman 17 1,019 12-17-2025, 04:43 AM
Last Post: SMcNeill
  SCREEN Function CletusSnow 8 803 11-16-2025, 05:09 PM
Last Post: TempodiBasic
  _MessageBox ignores default button johngreening 2 598 04-27-2025, 07:34 PM
Last Post: hsiangch_ong

Forum Jump:


Users browsing this thread: 1 Guest(s)