Page 1 of 1 1
Topic Options
#202011 - 2011-05-02 08:09 PM messagebox question
IMan Offline
Fresh Scripter

Registered: 2009-04-23
Posts: 15
Loc: California
Im kind of new to the kix scripts. I wanted to see if there was an easy way to have a message window pop up after the kix script runs like a messagebox, but i need to be able to change the colors of the window and text as well as keep that message on top until the user click OK. Is there anything like this?
Top
#202015 - 2011-05-02 08:29 PM Re: messagebox question [Re: IMan]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You can use KiXforms for this.
Check out www.kixforms.org
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202018 - 2011-05-02 09:00 PM Re: messagebox question [Re: Mart]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Kixforms can be a bit intimidating if you've never used it before, so here is a quick example using the kixforms classic .dll to get you started.

 Code:
$system = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Width = 300
$Form.Height = 200
$Form.Text = "Script Complete"
$Form.Icon = 13
$Form.Resizable = 0
$Form.MaximizeBox = 0
$Form.Location = 200, 200
$Form.BackColor = "Blue"

$Label = $Form.Controls.Add("Label")
$Label.Text = "Script completed successfully."+@CRLF+"Click OK to continue."
$Label.TextAlign = 32
$Label.Width = $Form.Width-25
$Label.Height = $Form.Height-90
$Label.Top = 10
$Label.Left = 10
$Label.ForeColor = "Gainsboro"

$OKButton = $Form.Controls.Add("ToolButton")
$OKButton.Text = "OK"
$OKButton.Top = $Label.Bottom+10
$OKButton.Left = $Form.Width/2-$OKButton.Width/2
$OKButton.OnClick = "$$Form.Hide()"
$OKButton.BackColor = "Gainsboro"

$Form.ShowModal()
While $Form.Visible
   $Nul = Execute($Form.DoEvents)
Loop
Exit 0

Top
#202029 - 2011-05-03 11:58 AM Re: messagebox question [Re: ShaneEP]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
You can also use the built in messagebox command or old style with at commands. Always multiple ways to achieve a result.
Top
#202083 - 2011-05-04 07:51 PM Re: messagebox question [Re: BradV]
IMan Offline
Fresh Scripter

Registered: 2009-04-23
Posts: 15
Loc: California
thanks everyone, ill give this a try.
Top
#202086 - 2011-05-04 09:30 PM Re: messagebox question [Re: IMan]
IMan Offline
Fresh Scripter

Registered: 2009-04-23
Posts: 15
Loc: California
everything is working great, thanks. I have one other question about a kixform message box, can i add an image to the top right of the label area? its a png image with the company logo.
Top
#202088 - 2011-05-04 10:02 PM Re: messagebox question [Re: IMan]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
PNG images only work in KiXforms.NET.

The example below places a red triangle at the top right of the label. It assumes that the file redtriangle.png is in the same folder as the script is.

 Code:
Break On
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$Form1 = $System.Form()
$Form1.Left = 0
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(271,215) ;(Width,Height)
$Form1.Text = "Form1"
$Form1.Top = 0

$Label1 = $System.Label()
$Label1.BorderStyle = 1  ;FixedSingle
$Label1.Height = 40
$Label1.ImageAlign = 1  ;Top,Left
$Label1.Left = 60
$Label1.Text = "Label with some text in it and an image at the top left corner."
$Label1.Top = 40
$Label1.Width = 130
$nul = $Form1.Controls.Add($Label1)

$Label1.Image = $System.Bitmap(@SCRIPTDIR + "\redtriangle.png")

$Form1.Show  ;Displays the Form

While $Form1.Visible
   $Nul = Execute($Form1.DoEvents())
Loop
Exit 0


Attachments
226.png
Description:




Edited by Mart (2011-05-04 10:09 PM)
Edit Reason: Too much code with the base64 image. Switched to file image.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 661 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.159 seconds in which 0.094 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org