I am using Windows 7 and 10 rakudo-star-2019.03-x86_64 (JIT)
. I would like to know how I can create a pop up window in Perl6 to give information to the user? Something like Linux's send-notify or Windows Pro msg (without the networking)
Many thanks, -T
Is a simple Messagebox good enough? Then
use NativeCall;
constant WCHAR = uint16;
constant INT = int32;
constant UINT = uint32;
constant HANDLE = Pointer[void];
constant LPWCTSTR = CArray[WCHAR];
constant MB_ICONEXCLAMATION = 0x00000030;
sub MessageBoxW( HANDLE, LPWCTSTR, LPWCTSTR, UINT ) is native('user32') returns INT { * };
MessageBoxW( my $handle, to-c-str("๘❤ Raku is awesome ❤๖"), to-c-str("Hellö Wαrld"), MB_ICONEXCLAMATION );
sub to-c-str( Str $str ) returns CArray[WCHAR]
{
my @str := CArray[WCHAR].new;
for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; }
@str[ $str.chars ] = 0;
@str;
}
For anything more complex, the only option available right now for GUIs are bindings for Tk I believe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With