Old 26th May 2011, 05:12   #1
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Adding Button on Cutom Page

Hello All,

I have created a custom page in which we can entered input required for database connection like username,password,url ... I want to add a button "test" that immediate test whether connection can be established ..

Can anyone suggest me how can i add a button on custom page and how can i check databse connection on button click event..


Thanks...
atliano is offline   Reply With Quote
Old 26th May 2011, 05:17   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
The nsDialogs readme has an excellent tutorial:
http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

As for database connection, you can try searching the forums, but NSIS is not database software so we can't help you unless you give more information.
MSG is offline   Reply With Quote
Old 26th May 2011, 06:10   #3
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Quote:
Originally Posted by MSG View Post
The nsDialogs readme has an excellent tutorial:
http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

As for database connection, you can try searching the forums, but NSIS is not database software so we can't help you unless you give more information.
Thanks for your reply..

Could you please let me know how can i perform operation on clicking button..
for databse connection i have wriiten batch file which takes database information from custom pages and i have add a button test on that page olso..now i want to run that batch file which checks whether the information provided by user makes the connection or not...


Thanks
atliano is offline   Reply With Quote
Old 26th May 2011, 07:23   #4
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 562
Send a message via ICQ to T.Slappy
Use
Quote:
nsDialogs::OnClick control_HWND function_address
Example:
PHP Code:
${NSD_CreateButton0 0 10012u Test
Var /Global BUTTON
Pop $BUTTON
GetFunctionAddress 
$0 OnClick
nsDialogs
::OnClick $BUTTON $0

Function OnClick
    Pop 
$# HWND
        # Do your stuff here...
    # MessageBox MB_OK clicky
FunctionEnd 

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2022: www.visual-installer.com
or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 26th May 2011, 09:06   #5
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Thanks for your reply...
This is not what i required..
I have posted my page ..as you can see i have add a button "Test" now i want that on clicking this test button my batch file starts running and from that batch file i need to redirect my db connectivity output to my installer page..
can anyone help me in doin this..?


Thanks..
Attached Thumbnails
Click image for larger version

Name:	dbs.png
Views:	169
Size:	32.5 KB
ID:	48868  
atliano is offline   Reply With Quote
Old 26th May 2011, 11:19   #6
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Hi All.

Last edited by atliano; 26th May 2011 at 13:47.
atliano is offline   Reply With Quote
Old 26th May 2011, 13:35   #7
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
We are not going to write your installer for you. You have already been given all the information you need to make your custom page work. Slappy's post describes exactly what you need (and you could also have found that information yourself if you had looked at the nsDialogs readme).

As for your question about how to capture the output of a batch file, I think the ExecDos plugin can do that (to some extent). But it's better to write to a .txt file for example (use something like "command.exe param1 param2 > yourfile.txt" in the batch file), and read that using the FileRead command.
MSG is offline   Reply With Quote
Old 31st May 2011, 06:56   #8
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Hi All,

Thanks MSG for ur reply ..even i am not saying to write an installer for me..Watever Solution Slappy had wriiten is not working for me..its because i have mase my custom page usinh ini file...
and i want to perform some task on clicking my button that is defined in ini file...
Above wriiten code bascically adds a new dialog that i dont required...
Can any one knw how to get address of button defined in '.ini' file at run time and do some operations on clicking that button..

Thanks
atliano is offline   Reply With Quote
Old 31st May 2011, 07:24   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
I haven't used InstallOptions in ages, so I really can't remember if it even supports onClick events in the first place... But either way, please switch to nsDialogs. InstallOptions is only supplied with NSIS for backwards compatibility. It should not be used for new installers.
MSG is offline   Reply With Quote
Old 31st May 2011, 10:54   #10
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
Quote:
Can any one knw how to get address of button defined in '.ini' file at run time and do some operations on clicking that button..
This is explained in the InstallOptions Readme documentation. You should also look at the InstallOptions example scripts that come with NSIS.
pengyou is offline   Reply With Quote
Old 31st May 2011, 12:46   #11
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Hi All,

Thanks a ton Peng You..yeah i Read it from manual and i got the Solution of my problem...
I need to know one more thing, I want that on clicking button (defined in my ini file), dynamically it generates a label on same page and display text whatever we want...
Can anyone have idea about it??

Thanks...
atliano is offline   Reply With Quote
Old 31st May 2011, 13:59   #12
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
Define the label in your .ini file but use the ShowWindow command to hide the label before the custom page is shown. When the button is clicked use SendMessage to set the label text and use ShowWindow to show the label. (The testnotify.nsi example script uses SendMessage to change the text on some controls.)
pengyou is offline   Reply With Quote
Old 2nd June 2011, 07:47   #13
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
Hi All,

Hey Pengyou Thanks for ur Wonderful Help...I really got good suggestion on my post..
Thanx to all..
I just left with one thing ...i need to know how can i change text color of label...Please if anyone know the color values...post here..Basically i need color value (Red and Green) for my text of label...

Thanks
atliano 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