Old 30th June 2007, 17:18   #1
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
nsDialogs

It's time for something really new. I wrote a plug-in that should replace InstallOptions in the near future. It should be faster, more capable, far more customizable and easier to use. Currently it can create any type of control, call callback functions directory from the script and create dialogs without all the INI files overhead.

It supports specifying units in pixels, dialog units and percentage - both positive and negative. It has a callback for TEXT field changes and for the back button. It's way faster. It has complete control over the style of the generated controls, including extended styles.

When it's done, it'll be even possible to create a real-time InstallOptions to nsDialogs converter that'd simply read the INI file and create the dialog according to it.

At the moment, creating a control requires quite a lot of parameters, but in the future it'll have a library of macros or functions that'd allow easier creation that requires nothing more than a type and location - just like with InstallOptions.

Play with it and let me know if you have any suggestions or issues in mind. Attach cool examples here or useful macros you write and I'll probably include them when nsDialogs goes into CVS.
Attached Files
File Type: zip nsdialogs.zip (13.0 KB, 1021 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 30th June 2007, 17:28   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That's very nice. Can ExecuteCodeSegment be used in any NSIS plugin?

Stu
Afrow UK is offline   Reply With Quote
Old 30th June 2007, 17:30   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes, any plug-in. It has been added in NSIS 2.03 and as far as I know, this is the first plug-in to use it.

edit: actually, there's already my incomplete nsXML.
edit2: the UAC plug-in too...

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 30th June 2007, 18:23   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I cannot believe that went unnoticed lol
I can use that in my ButtonEvent plugin

Edit: Done.

Stu
Afrow UK is offline   Reply With Quote
Old 30th June 2007, 22:41   #5
Backland
Senior Member
 
Join Date: Sep 2006
Posts: 150
Excellent work, sounds like a major improvement in terms of custom installer dialogs.
Backland is offline   Reply With Quote
Old 1st July 2007, 17:57   #6
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
looks nice
Comm@nder21 is offline   Reply With Quote
Old 1st July 2007, 18:22   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
And here's the first version of the script that converts existing INI files to a new dialog. Shouldn't be too hard to have it generate the script itself as well.

The plug-in itself has changed a bit and now takes the text parameter as the last parameter to nsDialogs::CreateItem.
Attached Files
File Type: zip nsdialogs.zip (5.3 KB, 575 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 6th July 2007, 12:46   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
And with browse buttons too.
Attached Files
File Type: zip nsdialogs.zip (6.5 KB, 705 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 10th July 2007, 19:55   #9
Backland
Senior Member
 
Join Date: Sep 2006
Posts: 150
This is really great for for creating on the fly interfaces, but will it be able to setup event handlers for controls defined in the INI?
Backland is offline   Reply With Quote
Old 10th July 2007, 21:16   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The NOTIFY flag will eventually be supported by the IO2nsDialogs function. But you can already do the same when using nsDialogs directly with nsDialogs::OnClick and nsDialogs::OnChange which is not even supported by InstallOptions.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 12th July 2007, 08:22   #11
Backland
Senior Member
 
Join Date: Sep 2006
Posts: 150
Is it possible to set nsDialogs::OnClick for controls created from an IO script? that would be the ultimate solution for getting the best of both formats.
Backland is offline   Reply With Quote
Old 12th July 2007, 17:21   #12
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes. All the conversion does is read the INI file and use nsDialogs according to it. You can read the HWND from the INI and use nsDialogs::OnClick with it.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th July 2007, 22:25   #13
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
just wanted to say: very cool. I'll be awaiting the usual first few days of "zomg - it just imploded!" before tinkering with it myself, after which our highly customized installer will probably be moving to nsDialogs from InstallOptions. Should save a bunch of code and - more importantly - run faster (takes a second on some of the heavier dialogs on my P1.6M). Might keep the INIs, as currently there's no GUI interface designer for nsDialogs, is there?
Animaether is offline   Reply With Quote
Old 14th July 2007, 22:27   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That would be handy

Stu
Afrow UK is offline   Reply With Quote
Old 15th July 2007, 21:55   #15
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I want to transfer some scripts where in custom page leave function there are several ReadINIStr conditions and actions' dependency.

How should I do that?
Are there any suggestions and/or tips?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 16th July 2007, 13:30   #16
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Well... I guess I should start from scratch, thanks

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 16th July 2007, 13:53   #17
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
your question is a bit vague, so I'm not sure what the answer would be. The way I'm reading it right now is that you're using the INI file as a form of variable storage - and depending on the multiple values in the INI file (in the variables), you take a particular action.

Sounds to me like you could...
A. Stick to using an INI file - except that for each control's callback you'll need to write out the value manually.
B. For each control's callback, write to a different text file. (Essentially the same as the ini - but more work)
C. For each control's callback, assign the value to a runtime variable - and instead of reading from an ini / text file, read the runtime variable.

In essence, nsDialogs makes creating the dialogs more flexible, faster (code execution-wise) and independent of ini file storage. Those are the immediate Pros. The immediate cons are that a lot of the automation is gone. I.e. changing a text box's text doesn't automatically store this - you'll have to store this yourself (in a variable of file), through a function that you have to write out, and then associate with the text box's change handler. So on the face of it - it's certainly a good bit more work. I suspect that as you get used to it, though, it'll prove to be a great enhancement.

Eventually some GUI editor for use with nsDialogs will come up and in each control's property sheet there'll just be a "code block to execute when changed" sort of text box, along with a small "code block name", which together simply set up all the Function handling and such for you.

Of course, if it remains something where you think "InstallOptions did just fine for me, and I'm more comfortable with it" - well, InstallOptions doesn't appear to be going away, and the InstallOptionsEx author(s) might have a thing or two to say about the Pros/Cons and decide to continue development there as well
Animaether is offline   Reply With Quote
Old 17th July 2007, 22:54   #18
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Just a suggestion, would be nice to have NSD_ macros for OnClick etc, and have GetFunctionAddress in them.

Stu
Afrow UK is offline   Reply With Quote
Old 18th July 2007, 03:30   #19
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
/ot: would be nice to handle pluginsdir in memory - not on disk

still working on a "installer script language"?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 18th July 2007, 06:04   #20
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Brummelchen, you can't load DLL files from memory. How is this related to a new scripting language?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th July 2007, 15:59   #21
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
If you don't want to use $PLUGINSDIR, extract the DLL yourself and use CallInstDLL instead. For example, the NSISArray plugin has built in support for this while still using the macros.

Stu
Afrow UK is offline   Reply With Quote
Old 18th July 2007, 17:37   #22
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
as long i write installers i dont care on pluginsdir.
as i started with portables like portableapps.com i wish
to have that in memory - but ok, this is really /ot now.

i appreciate a newer gui with modern commands - but i dont
really get the point on mouse-effects or similar jokes
on an "installer script"

but - if nsis goes away from a simple installer script -
and it does - why not to ask for that option above!?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 18th July 2007, 17:41   #23
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Brummelchen, implement a memory-DLL loader and I'll include it.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th July 2007, 17:48   #24
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
"i'm afraid dave - i cant do this"
i am no programmer - i can do only scripts
but if that would be possible - much appreciated

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 18th July 2007, 17:50   #25
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Quote:
Brummelchen, you can't load DLL files from memory.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 19th July 2007, 08:32   #26
tdue
Junior Member
 
Join Date: Jul 2007
Posts: 3
Hello,

Is there an automated method of converting a IO ini file to a nsDialogs script? I THOUGHT the io.nsi file in the zip file posted earlier would do it, but that does not seem to be the case.

In any event I have been playing around with NSIS (and HM NIS Edit) for the last couple of days. My installer experience is limited to InstallShield 10.5 and the build-in MSI installer in Visual Studio. I must say I am vastly impressed with NSIS.

I am seriously lacking integration with Source Safe and Visual Studio though, but I guess I can manage without... for now
tdue is offline   Reply With Quote
Old 20th July 2007, 16:55   #27
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
io.nsi only displays INI files using nsDialogs. In the future, it should also be able to create a script.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th July 2007, 16:59   #28
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
Well done!

I'd give my left toe in exchange for something that's better. Manually converting the controls seems to be the first step along the way. I've encountered a problem:

SetCtlColors $TEXT 0x000000 transparent

The nsDialogs Welcome.nsi example uses:

"" 0xffffff

Is "transparent" not supported?
bnicer is offline   Reply With Quote
Old 20th July 2007, 17:09   #29
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
"transparent" is a feature of NSIS and not nsDialogs, so it's supported just like in InstallOptions. nsDialogs simply forwards relevant messages to NSIS for handling the colors.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th July 2007, 17:21   #30
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
Oddly enough,

SetCtlColors $TEXT 0x000000 transparent

does not make the background transparent.

SetCtlColors $TEXT 0x000000 0x0000ff

changes the background to blue. ???
bnicer is offline   Reply With Quote
Old 20th July 2007, 17:47   #31
vbguy
Junior Member
 
Join Date: Jul 2006
Posts: 30
Quote:
Originally posted by bnicer
Oddly enough,

SetCtlColors $TEXT 0x000000 transparent

does not make the background transparent.

SetCtlColors $TEXT 0x000000 0x0000ff

changes the background to blue. ???
0x0000ff is blue.

This is how you set controls to transparent:

SetCtlColors $TEXT 0x000000 "transparent"
vbguy is offline   Reply With Quote
Old 20th July 2007, 17:51   #32
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Add the WS_EX_TRANSPARENT extended style to the CreateItem call and it should work.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th July 2007, 18:04   #33
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
I always get white.

Compile Welcome.nsi with a transparent text background.
PHP Code:
Function nsDialogsWelcome

    nsDialogs
::Create /NOUNLOAD 1044
    Pop $DIALOG

    nsDialogs
::CreateItem /NOUNLOAD STATIC 

${
WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS0 120u 10u -130u 20u "Welcome to nsDialogs!"
    
Pop $HEADLINE

    SendMessage $HEADLINE 
${WM_SETFONT$HEADLINE_FONT 0

    nsDialogs
::CreateItem /NOUNLOAD STATIC 

${
WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS0 120u 32u -130u -32u "nsDialogs is the next generation..."
    
Pop $TEXT

    SetCtlColors $DIALOG 
"" 0xffffff
    SetCtlColors $HEADLINE 
"" 0xffffff
    SetCtlColors $TEXT 0xffffff 
"transparent"

    
nsDialogs::CreateItem /NOUNLOAD STATIC 

${
WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP0 0 0 109u 193u ""
    
Pop $IMAGECTL

    StrCpy 
$0 $PLUGINSDIR\welcome.bmp
    System
::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 497, i 0, i ${LR_LOADFROMFILE}) i.s'
    
Pop $IMAGE
    
    SendMessage $IMAGECTL 
${STM_SETIMAGE} ${IMAGE_BITMAP$IMAGE

    Call HideControls

    nsDialogs
::Show

    Call ShowControls

    System
::Call gdi32::\DeleteObject(i$IMAGE)

FunctionEnd 
bnicer is offline   Reply With Quote
Old 20th July 2007, 18:13   #34
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
That example doesn't use WS_EX_TRANSPARENT, you need to add it. Replace the 0 that comes after the styles with ${WS_EX_TRANSPARENT}. Don't forget to copy its definition from nsDialogs.nsh.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th July 2007, 18:18   #35
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
WS_EX_TRANSPARENT extended style; how do I define it?

I have, so far...
PHP Code:
nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|$(WS_EX_TRANSPARENT0 120u 32u -130u -32u "nsDialogs is the next generation..." 
bnicer is offline   Reply With Quote
Old 20th July 2007, 18:19   #36
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Take the definition from nsDialogs.nsh and replce the zero before 120u with it.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th July 2007, 18:21   #37
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
Thanks. Our replies keep on crossing. I'll try that.
bnicer is offline   Reply With Quote
Old 21st July 2007, 21:29   #38
FoBoT
Junior Member
 
FoBoT's Avatar
 
Join Date: Aug 2006
Location: Holden MO
Posts: 19
does the BrandingImage stuff work with this yet?
I copy/pasted the commands below into InstallOptions.nsi pointing to my .ini file

ChangeUI all "${NSISDIR}\Contrib\UIs\modern.exe"
AddBrandingImage top 20
SetBrandingImage "$PLUGINSDIR\logo.bmp"

from a working InstallOptions version and it displays correctly except the logo is missing from the top of the page
FoBoT is offline   Reply With Quote
Old 21st July 2007, 22:13   #39
FoBoT
Junior Member
 
FoBoT's Avatar
 
Join Date: Aug 2006
Location: Holden MO
Posts: 19
also, is the functionality in place yet to change the cancel/next button labels? for example my old .ini files has:

[Settings]
NumFields=2
Title=Control Panel
CancelEnabled=1
CancelShow=1
BackEnabled=1
CancelButtonText=Exit
NextButtonText=Enter

so that the cancel/next buttons display custom text

thank you
FoBoT is offline   Reply With Quote
Old 22nd July 2007, 01:17   #40
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
You can always do that manually, FoBoT. In fact, it's more flexible with nsDialogs as you can enable/disable / change texts on those buttons dynamically based on what the user is doing - with any dialog item rather than only those that would cause an InstallOptions exit.

code:

GetDlgItem $0 $HWNDPARENT 1 ; Next button
SendMessage $0 ${WM_SETTEXT} 0 "STR:Custom Next"
GetDlgItem $0 $HWNDPARENT 3 ; Next button
SendMessage $0 ${WM_SETTEXT} 0 "STR:Custom Back"

Animaether is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump