Archive: nsDialogs Questions


nsDialogs Questions
Hi all, i have a couple questions about nsDialogs.

1. Measurements in Units

It supports specifying units in pixels, dialog units and percentage
Whats with the units there ? How many units do you have in each direction?

2. Callback from ${NSD_CreateText}

How can i store whatever i have entered in the Textbox in a variable.

I have checked the "example.nsi" where the "hello there" is compared in a function and initiates a Messagebox. If i understand it correctly it is invoked every time after i typed a letter, then compared and, if it matches, the messagebox is displayed.

Would i have to do the same to just get the final text in the box in a variable ? If i have 7 textboxes do i need 7 funtions then to retreive the value(s) ?

Thanks for helping, and could i ask for a little example for the textbox issue, my textbox looks like this:


${NSD_CreateText} 10 60 45% 12u Username
Var /GLOBAL TEXT_USER_Name
Pop $TEXT_USER_Name



xBarns

1. I don't understand the question. For each measurement, you can use whichever unit you wish.

2. You can get the text in the leave function of the page. There's no need to create a callback, if all you want is getting the final text.


1. I don't understand the question. For each measurement, you can use whichever unit you wish
Darn, my fault again!

Ok i was talking about the dialog units, for instance there is (probably) not more than 100% so most people will not get the idea to put in 150%.

So how do i "work" with dialog units, that was my intention to find out.


2. You can get the text in the leave function of the page.
Could you give me an example of how exactly to do this.

I am using UMUI so i guess i have to insert "MUI_PAGE_CUSTOMFUNCTION_LEAVE function" and then do what you suggest in that function.

I tried it and get an emtpy Messagebox before the page is displayed.


Function LeaveFunc

System::Call user32::GetWindowText(i$TEXT_USER_Name,t.r0,i${NSIS_MAX_STRLEN})

MessageBox MB_OK $0

FunctionEnd

1. You can't have dialogs units in percentage. You can only use one of the two. 200% doesn't mean twice the normal size, it means twice the entire dialog's size.

2. MUI_PAGE_CUSTOMFUNCTION_LEAVE is for non-custom pages. For custom pages, you use just pass another parameter to Page which points to the leave function.


First of all thanks for helping me, i really appreciate it.

1. You can't have dialogs units in percentage. You can only use one of the two. 200% doesn't mean twice the normal size, it means twice the entire dialog's size.
Yes i know that, hmm let me rephrase:

There are 3 Types of units:

I just wanted to know what (and how) Dialog Units are used for (i know about pixels and percentage). I tried to work with it but i have not figured out how they work.



2. MUI_PAGE_CUSTOMFUNCTION_LEAVE is for non-custom pages. For custom pages, you use just pass another parameter to Page which points to the leave function.
I now have:


Page custom nsDialogsIO LeaveFunc


to invoke the Dialog and i do end up in "LeaveFunc" when leaving the Dialog.


And my Dialog looks like this:


Function nsDialogsIO

nsDialogs::Create /NOUNLOAD 1018
Var /GLOBAL DIALOG
Pop $DIALOG
SetCtlColors $DIALOG "" ${MUI_BGCOLOR}

${NSD_CreateText} 10 185 90% 12u "Enter Sharename here"
Var /GLOBAL TEXT_SHARE_Name
Pop $TEXT_SHARE_Name

nsDialogs::Show
FunctionEnd


And now what do i have to put in the Function so i can get the value that is entered in the dialog ? I tried with whats used in example.nsi ("hello there") but i don't get it to work.

My LeaveFunction looks like this


Function LeaveFunc

MessageBox MB_OK "Here i am !"

System::Call user32::GetWindowText(i$TEXT_SHARE_Name,t.r0,i${NSIS_MAX_STRLEN})

${If} $0 <> ""
MessageBox MB_OK $0
${EndIf}

FunctionEnd

1. Dialogs units are units relative to font size. If you're using a bigger font, they'll take more pixels. That's the units you use when editing dialogs in Visual C.

2. The code doesn't work because `<>` is used to compare integers. You need `!=`.


It's working :D :D :D

Thank You :up: