Old 3rd March 2009, 12:57   #1
nick_goyal
Junior Member
 
Join Date: Aug 2008
Posts: 24
Problem in using message box with custom page

i am using one custom page to check the "TCP-Port" whether its open or occupied and if it is occupied it is throwing a message saying this port is occupied.

my problem is when i click "ok" in "message box" the page moved to the next page and i have to come back to the old page to change the port. Is there any way to stay at the same page after clicking the "ok" button of the message box.

My Function for this operation is


Function CustomPage

InstallOptions::dialog "$PLUGINSDIR\CustomPage.ini"
ReadINIStr ${TEMP1} "$PLUGINSDIR\CustomPage.ini" "Field 2" "State"
${Unless} ${TCPPortOpen} ${TEMP1}
#MessageBox MB_OK "${TEMP1} port is free"
${Else}
MessageBox MB_OK "${TEMP1} port is occupied please use some other port "
${EndIf}
FunctionEnd


Truly grateful for any assistance on this issue.

Thanks a million!
nick_goyal is offline   Reply With Quote
Old 3rd March 2009, 13:43   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Abort is the option.

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 4th March 2009, 04:59   #3
nick_goyal
Junior Member
 
Join Date: Aug 2008
Posts: 24
Thank you for early reply Red Wine But this option is not working (i used Abort just after the Message Box).
Can you please tell me where to put Abort in this function.

Thanks in Advance
nick_goyal is offline   Reply With Quote
Old 4th March 2009, 06:09   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
http://nsis.sourceforge.net/Docs/Chapter4.html#4.5.3
MSG is offline   Reply With Quote
Old 4th March 2009, 08:34   #5
nick_goyal
Junior Member
 
Join Date: Aug 2008
Posts: 24
Hi MSG,

I have gone through this documentation but not able to use them as per my requirement, This Abort is not working under the condition and after clicking on OK (Message Box)it take me to the next page.

Thanks in Advance
nick_goyal is offline   Reply With Quote
Old 4th March 2009, 10:12   #6
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
might not have read the documentation correctly, then.. you must call Abort in the custom page's Leave function, not in the Create function

code:

Page Custom CustomPageCreate CustomPageLave

Function CustomPageCreate
InstallOptions::dialog "$PLUGINSDIR\CustomPage.ini"
FunctionEnd

Function CustomPageLeave
ReadINIStr ${TEMP1} "$PLUGINSDIR\CustomPage.ini" "Field 2" "State"
${Unless} ${TCPPortOpen} ${TEMP1}
#MessageBox MB_OK "${TEMP1} port is free"
${Else}
MessageBox MB_OK "${TEMP1} port is occupied please use some other port "
Abort
${EndIf}
FunctionEnd



Edit: You might want to check to make sure that the user actually pressed the Next button by checking '"CustomPage.ini" "Settings" "State"'. If the value of that ini var is 0 (zero), then the user pressed the Next button.

I highly recommend moving up to nsDialogs, by the way
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