Archive: Is this bug or what?


Is this bug or what?
Hi,

I am trying to disable certain elements of the Dir. selection page when the installer is not running for the 1st time. The following code does that but it also disabling the keyboard. (I mean the eneter key, and hot keys(Alt N, Alt B etc.) are not working...)


; HM NIS Edit Wizard helper defines
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MyAPP.exe"

....

!define MUI_PAGE_CUSTOMFUNCTION_SHOW CustomDirShow
!insertmacro MUI_PAGE_DIRECTORY
....

InstallDir "$PROGRAMFILES\MyApp"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""

Var IsPresent

Function .onInit
;Check if product already installed...
ReadRegStr $IsPresent HKLM "${PRODUCT_DIR_REGKEY}" ""
FunctionEnd

;Disable the Dir. selection if running in upgrade mode...
Function CustomDirShow
StrCmp $IsPresent "" +6 0
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1019 ;ID of the EDIT box in Dir. Page
EnableWindow $R1 0
GetDlgItem $R1 $R0 1001 ;ID of the Browse button in Dir. Page
EnableWindow $R1 0
FunctionEnd

-- so what's gone wrong here?

------------
NSIS:2.0.6
OS:Win98SE
------------

Thanks,
playwin2

Well I'm guessing the hot keys are assigned to the text field of the page, so they aren't working anymore because you've disable the text field control.

Perhaps it will work if you make the text field read only instead of disabled (not sure how though).

-Stu


Seems you are right.

Just sending the EM_SETREADONLY msg. did the trick.


GetDlgItem $R1 $R0 1019 ;ID of the EDIT box in Dir. Page
SendMessage $R1 0x00CF 1 0


Hmm! so we got three options now:
1--> Skip the entire Dir. page
2--> Disable components in the Dir. page ( and accept that the keyboard in sauce)
3--> Make the edit box of the Dir. page read-only.

-- Which one do you suggest?

--
playwin2

I'd say option 1. What's the point of showing the dialog if you can't do anything with it?


Well it's usually nice to show the user where they are installing to. You could have a simple messagebox instead though.

-Stu


Originally posted by Afrow UK
Well it's usually nice to show the user where they are installing to.
Agreed.
--
playwin2