I'm trying to display a page in NSIS to obtain two different values. I want both to be not empty. The page actually displays altough I can't get my page leave function to check properly for empty fields.
Function CCInstallOpts
ReserveFile "cc_installopt.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "cc_installopt.ini"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "cc_installopt.ini"
FunctionEnd
My page leave function where I validate fields (4 and 5 ) is :
Function CCInstallOptsLeave
Push $R0
Push $R1
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field5" "State"
StrCmp $R0 "" mustcomplete
StrCmp $R1 "" mustcomplete
StrCpy $CC_CyberID $R0
StrCpy $CC_VCode $R1
goto exitfunc
mustcomplete:
MessageBox MB_OK|MB_ICONEXCLAMATION "Empty not allowed"
Abort
exitfunc:
Pop $R1
Pop $R0
FunctionEnd
Note that I want to store the entered values into $CC_VCode and $CC_CyberID variables to be later used on different files (I've defined both as:)
Var /GLOBAL CC_VCode
Var /GLOBAL CC_CyberID
Thanks in advance.
You are missing a space in the field name
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field 5" "State"
Related
I have a UITextField that has the "Secure Text Entry" checked in my storyboard.
When I assign the text of the UITextField.text property to a variable I get a value of:
class name = _NSClStr
instead of the actual value of the text which is:
ABCD
If I uncheck the "Secure Text Entry" in the storyboard and do the same assignment to a variable I get the actual text.
The code to assign the value is pretty simple:
passFieldText = self.passField.text!
The debugger output for when the secure entry is enabled:
(lldb) print passFieldText
(String) $R0 = class name = _NSClStr
The debugger output for when secure entry is disabled:
(lldb) print passFieldText
(String) $R0 = "ABCD"
I even tried to use a local variable instead of a class variable:
let passFieldText = self.passField.text ?? ""
Same result!
(lldb) print passFieldText
(String) $R0 = class name = _NSClStr
The passFieldText is passed along to another function to validate the password and in that other function it also shows a value of class name = _NSClStr
What am I missing?
Cheers!
I had the same issue, the only way to fix it is to interpolate the String:
password = "\(self.passField.text)"
It's not exclusive for print()
So the cause of my problem was not the text from the password field. It turned out to be an issue with an external service.
However, to help anyone else to see the actual value of their password fields in code I'll share the suggestion by Dominik 105 and how I implemented it.
To see the value of the password field if I put the PRINT in code I see the actual value of the password field.
print("password1: \(self.passField.text ?? "")")
gives me the result I expect
ABCD
If I do the same PRINT in the debugger output I see the _NSClStr thing.
Help me please to decide problem with listbox in TCL.
I created the next listbox:
listbox .lb1 -height 6 -width 10 -selectmode browse
.lb1 insert 0 "String 1" "String 2" "String 3" "String 4" "String 5" "String 6"
label .label1 -text [.lb1 get active]
button .butt1 -text "enter" -command {.label1 configure -text [.lb1 get active]}
pack .label1 .lb1 .butt1 -expand yes -fill both
How I can change automatically contents of label "label1" without use button "butt1" ?
I want the contents of "label1" will change immediately when I click on one of the list items.
Thanks!
When you select an item in the listbox, it sends the <<ListboxSelect>> to itself. You can bind to this to react to selection changes:
bind .lb1 <<ListboxSelect>> {.label1 configure -text [.lb1 get active]}
Note that you're also getting very close to the point where using a helper procedure is advised. Even for something simple like this, it makes things easier to write, test and debug.
proc SelectionHappened {listbox label} {
set activeItem [$listbox get active]
$label configure -text $activeItem
}
bind .lb1 <<ListboxSelect>> {SelectionHappened .lb1 .label1}
I have a Windows Form Multiline Textbox.
I want to use Shift+Enter Instead of using Enter key to make a new line in textbox, and the traditional Enter key will be used to focus on the next control.
I mean Shift+Enter will work exactly like Enter key on normal multiline textbox (Regard to textbox maxlength --> So you cant enter newline, or current selected text will be delete when you insert newline,...)
I've tried to override OnKeyDown, to insert newline on Shift+Enter, but it doesn't work as I expected.
you'll need to override OnKeyDown and check for enter key using the KeyDownEvent's KeyCode property.
If enter was pressed and the keydownevent's modifiers property does not equal Keys.Shift you'll need to suppress the key press. Here's the documentation on how to do that:
http://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs.suppresskeypress(v=vs.110).aspx
If shift+enter was pressed you'll need to insert Environment.NewLine at the cursor position, then move the cursor after the inserted Environment.NewLine. Here's how to do that:
How to paste text in textbox current cursor?
Here is my implementation in VB .NET.
Regard to Maxlength of the textbox and current selected text
Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
If (Me.Multiline AndAlso e.KeyData = (Keys.Shift Or Keys.Enter)) Then
Dim intRemainCharCount As Integer = Me.MaxLength - Me.Text.Length + Me.SelectedText.Length
'' Check if have enough space to place NewLine
If (Environment.NewLine.Length > intRemainCharCount) Then
MyBase.OnKeyDown(e)
Return
End If
Dim intPos = Me.SelectionStart
Me.Paste(Environment.NewLine)
'' Reset selection start (Reset cusor position)
Me.SelectionStart = intPos + Environment.NewLine.Length
e.Handled = True
e.SuppressKeyPress = True
Return
End If
MyBase.OnKeyDown(e)
End Sub
Change the property for Accept Return for the Multiline doesn't even require coding anything, unless you have an event listening to the KeyDown, in which case you can put a condition to check if the Textbox is focussed.
I have a +ruby version of vim 7.2 (also tried with 7.3 and custom compiled version) but I am only getting the omnicomplete (ctrl-x ctrl-o) to work in certain instances.
For example, if I have
class MegaGreeter
attr_accessor :names
def initialize(names = "world")
#names = names
if #names.nil?
puts "hello #{#names}.each"
end
end
end
omnicomplete works for .each, but not for .nil. Also, it won't auto complete any attr_ keywords.
I have tried it with all my plugins disabled, again with all of them enabled. I have tried it also with the vim-ruby plugin. The plugins I have installed are AfterColors, CSApprox, surround, color_sample_pack, mimicpak, taglist.
I have the following section in my .vimrc (I can post entire .vimrc if needed). I also use VIM for C++, JavaScript, and about a 1/2 dozen other languages, so there is omnicomplete stuff in there for some of them too:
" ============================ "
" CTAGS / OMNICOMPLETE
" ============================ "
" map <ctrl>+F12 to generate ctags for current folder:
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>
" add current directory's generated tags file to available tags
set tags+=./projects/.tags
" toggle list view
map <F4> :TlistToggle<cr>
" auto close omnicomplete options when exiting insert mode
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" configs for cpp
let OmniCpp_MayCompleteDot = 1 " autocomplete with .
let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype (i.e. parameters) in popup window
if has("win32")
let Tlist_Ctags_Cmd='c:\programs\ctags\ctags58\ctags.exe'
else
if has("win32unix")
let Tlist_Ctags_Cmd='/usr/bin/ctags.exe'
else
if has("unix")
let Tlist_Ctags_Cmd='/usr/bin/ctags'
endif
endif
endif
" omnicomplete settings for the popout menu
setlocal omnifunc=syntaxcomplete#Complete
" makes list show longest matching item at top of list
set completeopt=menuone,longest
" makes enter select item
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr> <Space> pumvisible() ? "\<C-y>" : "\<Space>"
inoremap <expr> <.> pumvisible() ? "\<C-y>" : "\<.>"
inoremap <expr> <S-CR> pumvisible() ? "\<C-n>\<C-y>" : ""
"manual up/down with tab & shift+tab
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : ""
"allows for autoselect of first item in user complete list
inoremap <expr> <C-n> pumvisible() ? '<C-n>' : '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
"allows autoselect of first item for omni complete
inoremap <expr> <leader>' pumvisible() ? '<C-n>' : '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
" open omni completion menu closing previous if open and opening new menu without changing the text
inoremap <expr> <C-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') .
\ '<C-x><C-o><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>'
" open user completion menu closing previous if open and opening new menu without changing the text
inoremap <expr> <S-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') .
\ '<C-x><C-n><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>'
" autocomplete for commands; and put most likely at top using tab complete
" (like windows cmd)
set wildmenu
set wildmode=list:longest
" for ruby
if has("autocmd")
filetype indent on
autocmd FileType cucumber,rspec,ruby set number
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_include_object = 1
autocmd FileType ruby,eruby let g:rubycomplete_include_objectspace = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
else
set autoindent
endif
" ruby requires bash --login;
" This is to correct running cmd from vim via :!
if has("unix")
set shell=/bin/bash\ -il
endif
"ruby end
So, is there a way I can get full support for Ruby in omnicomplete, if so how? Or, is this the most that omnicomplete has to offer for Ruby?
Vim auto-completion should work out of the box, I am not aware of any method .nil so I wouldn't be sure if that's a real issue.
However with regards to the omnicompletion not completing attr_reader and the likes, the setlocal omnifunc=syntaxcomplete#Complete fixes it, however it should go in a ftplugin/ruby/my_custom_ruby_ftplugin.vim instead of just in your vimrc, or alternatively if you like you could put that setl command within a autocmd FileType ruby setl omnifunc=syntaxcompelete#Complete in your vimrc and it should then work like you expect.
I thought Shell.Explorer means Webbrowser Control in AutoHotkey.
But as I view the output of the parameters of theNavigateError event, it is slightly different than the ones described in MSDN pages.
I found two different pages at MSDN for NavigateError.
DWebBrowserEvents2::NavigateError http://msdn.microsoft.com/en-us/library/aa768286%28v=vs.85%29.aspx
NavigateError Event http://msdn.microsoft.com/en-us/library/bb268221%28v=vs.85%29.aspx
Since the second parameter shows a url with the below code, I guess AutoHotkey is using the DwebBrowserEvents2 interface but the MSDN page says the method accepts 5 parameters while AutoHotkey receives 6 of them.
new WBConttrol("file:///" A_ScriptDir "/nofile")
class WBConttrol {
NavigateError(oParams*) {
msgbox, 64, % Parameters, % "the number of passed parameters: " oParams.MaxIndex() "`n"
. "1: " (IsObject(oParams.1) ? "object" : oParams.1) "`n"
. "2: " (IsObject(oParams.2) ? "object" : oParams.2) "`n" ; url
. "3: " (IsObject(oParams.3) ? "object" : oParams.3) "`n"
. "4: " (IsObject(oParams.4) ? "object" : oParams.4) "`n"
. "5: " (IsObject(oParams.5) ? "object" : oParams.5) "`n"
. "6: " (IsObject(oParams.6) ? "object" : oParams.6) "`n"
}
__New(strURL="") {
static WB
Gui, New, Resize MaximizeBox
Gui, Add, ActiveX, vWB w300 h200, Shell.Explorer
Gui, show, w300 h200
ComObjConnect(WB, this)
WB.Navigate(strURL)
}
}
Shell.Explorer does indeed mean the WebBrowser control.
The extra (sixth) parameter is defined in the documentation for ComObjConnect():
PrefixEventName([Params..., ComObject])
...
ComObject is optional, and can only be used if the correct number of Params are defined; it contains a reference to the original wrapper object which was passed to ComObjConnect.
The reason for this extra parameter is that some COM event methods do not define any parameters at all, and therefore don't provide a reference to the COM object which the event is being raised on.