Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #5053 > unrolled thread
| Started by | BGeorge <bgeorge21@in.gr> |
|---|---|
| First post | 2013-04-14 10:08 -0700 |
| Last post | 2013-04-15 22:45 -0700 |
| Articles | 11 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
How to use PushButton without Spacebar but with ENTER? BGeorge <bgeorge21@in.gr> - 2013-04-14 10:08 -0700
Re: How to use PushButton without Spacebar but with ENTER? Carlos Rocha <jazzda1307@gmail.com> - 2013-04-14 10:38 -0700
Re: How to use PushButton without Spacebar but with ENTER? Massimo Bighelli <info@arcasistemi.it> - 2013-04-14 20:51 +0200
Re: How to use PushButton without Spacebar but with ENTER? BGeorge <bgeorge21@in.gr> - 2013-04-15 12:09 -0700
Re: How to use PushButton without Spacebar but with ENTER? Massimo Bighelli <info@arcasistemi.it> - 2013-04-15 21:15 +0200
Re: How to use PushButton without Spacebar but with ENTER? BGeorge <bgeorge21@in.gr> - 2013-04-15 12:22 -0700
Re: How to use PushButton without Spacebar but with ENTER? Carlos Rocha <jazzda1307@gmail.com> - 2013-04-15 13:45 -0700
Re: How to use PushButton without Spacebar but with ENTER? BGeorge <bgeorge21@in.gr> - 2013-04-15 14:10 -0700
Re: How to use PushButton without Spacebar but with ENTER? Carlos Rocha <jazzda1307@gmail.com> - 2013-04-15 15:22 -0700
Re: How to use PushButton without Spacebar but with ENTER? BGeorge <bgeorge21@in.gr> - 2013-04-15 22:29 -0700
Re: How to use PushButton without Spacebar but with ENTER? Carlos Rocha <jazzda1307@gmail.com> - 2013-04-15 22:45 -0700
| From | BGeorge <bgeorge21@in.gr> |
|---|---|
| Date | 2013-04-14 10:08 -0700 |
| Subject | How to use PushButton without Spacebar but with ENTER? |
| Message-ID | <ca94d93d-35bd-4e72-bd96-7d5fcb051eff@googlegroups.com> |
I have a window that gets with two Singlelineedits the username and password and when I get to the password with ENTER i want to performs pushbutton. Sorry for my poor english. Regards George
[toc] | [next] | [standalone]
| From | Carlos Rocha <jazzda1307@gmail.com> |
|---|---|
| Date | 2013-04-14 10:38 -0700 |
| Message-ID | <5cdf6d94-c873-4ee9-9aa3-ba989db977f0@googlegroups.com> |
| In reply to | #5053 |
On Sunday, April 14, 2013 6:08:25 PM UTC+1, BGeorge wrote:
> I have a window that gets with two Singlelineedits the username and password and when I get to the password with ENTER i want to performs pushbutton.
>
Hi George,
I use this to trigger Ok button with the enter key:
METHOD Dispatch(oEvent) CLASS OkCancelDlg
IF oEvent:Message == WM_COMMAND .and. oEvent:lParam == 0L
IF oEvent:wParam == 2 // Escape pressed
IF IsMethod(SELF,#CancelButton)
Send(SELF,#CancelButton)
ELSE
SELF:EndDialog(0)
ENDIF
RETURN 1L
ELSEIF oEvent:wParam == 1 // Return pressed
IF IsMethod(SELF,#OkButton)
Send(SELF,#OkButton)
ELSE
SELF:EndDialog(1)
ENDIF
RETURN 1L
ENDIF
ENDIF
RETURN SUPER:Dispatch(oEvent)
Carlos
[toc] | [prev] | [next] | [standalone]
| From | Massimo Bighelli <info@arcasistemi.it> |
|---|---|
| Date | 2013-04-14 20:51 +0200 |
| Message-ID | <kketq7$fvi$1@speranza.aioe.org> |
| In reply to | #5053 |
Il 14/04/2013 19:08, BGeorge ha scritto: > I have a window that gets with two Singlelineedits the username and password and when I get to the password with ENTER i want to performs pushbutton. > > Sorry for my poor english. > > Regards > George > set the button as default button *Massimo Bighelli* ARCA Sistemi S.r.l.
[toc] | [prev] | [next] | [standalone]
| From | BGeorge <bgeorge21@in.gr> |
|---|---|
| Date | 2013-04-15 12:09 -0700 |
| Message-ID | <05f9f169-f50d-4f50-b6b0-13ee80aa032b@googlegroups.com> |
| In reply to | #5056 |
Hi Carlos,
I used your Method Dispatch but nothing happend.
CLASS anagnorisi INHERIT DIALOGWINDOW
PROTECT oDCFixedText1 AS FIXEDTEXT
PROTECT oDCFixedText2 AS FIXEDTEXT
PROTECT oDCSingleLineEdit1 AS SINGLELINEEDIT
PROTECT oDCSingleLineEdit2 AS SINGLELINEEDIT
PROTECT oCCOkButton AS PUSHBUTTON
PROTECT oCCCancelButton AS PUSHBUTTON
METHOD Init(oParent,uExtra) CLASS anagnorisi
LOCAL DIM aFonts[2] AS OBJECT
LOCAL DIM aBrushes[1] AS OBJECT
SELF:PreInit(oParent,uExtra)
SUPER:Init(oParent,ResourceID{"anagnorisi",_GetInst()},TRUE)
aFonts[1] := Font{,9,"Courier New"}
aFonts[1]:Bold := TRUE
aFonts[2] := Font{,12,"Courier New"}
aFonts[2]:Bold := TRUE
aBrushes[1] := Brush{Color{255,255,255}}
oDCFixedText1 := FixedText{SELF,ResourceID{ANAGNORISI_FIXEDTEXT1,_GetInst()}}
oDCFixedText1:HyperLabel := HyperLabel{#FixedText1,"Username:",NULL_STRING,NULL_STRING}
oDCFixedText1:BackGround := aBrushes[1]
oDCFixedText2 := FixedText{SELF,ResourceID{ANAGNORISI_FIXEDTEXT2,_GetInst()}}
oDCFixedText2:HyperLabel := HyperLabel{#FixedText2,"Password:",NULL_STRING,NULL_STRING}
oDCFixedText2:BackGround := aBrushes[1]
oDCSingleLineEdit1 := SingleLineEdit{SELF,ResourceID{ANAGNORISI_SINGLELINEEDIT1,_GetInst()}}
oDCSingleLineEdit1:HyperLabel := HyperLabel{#SingleLineEdit1,NULL_STRING,NULL_STRING,NULL_STRING}
oDCSingleLineEdit1:Font(aFonts[1], FALSE)
oDCSingleLineEdit1:TextLimit := 5
oDCSingleLineEdit2 := SingleLineEdit{SELF,ResourceID{ANAGNORISI_SINGLELINEEDIT2,_GetInst()}}
oDCSingleLineEdit2:HyperLabel := HyperLabel{#SingleLineEdit2,NULL_STRING,NULL_STRING,NULL_STRING}
oDCSingleLineEdit2:Font(aFonts[2], FALSE)
oDCSingleLineEdit2:TextLimit := 8
oCCOkButton := PushButton{SELF,ResourceID{ANAGNORISI_OKBUTTON,_GetInst()}}
oCCOkButton:HyperLabel := HyperLabel{#OkButton,"OK",NULL_STRING,NULL_STRING}
oCCCancelButton := PushButton{SELF,ResourceID{ANAGNORISI_CANCELBUTTON,_GetInst()}}
oCCCancelButton:HyperLabel := HyperLabel{#CancelButton,"¢êõñï",NULL_STRING,NULL_STRING}
SELF:Caption := "Áíáãíþñçóç"
SELF:HyperLabel := HyperLabel{#anagnorisi,"Áíáãíþñçóç",NULL_STRING,NULL_STRING}
SELF:ClipperKeys := TRUE
SELF:PostInit(oParent,uExtra)
RETURN SELF
METHOD OkButton( ) CLASS anagnorisi
//search in file of users for username and password
IF Found()
Done:=TRUE
ELSE
Done:=FALSE
SELF:EndDialog()
METHOD CancelButton class anagnorisi
Done:=FALSE
SELF:EndDialog()
That i want to do is when i am in singlelineedit2(password) after give the password and press enter i want to do OkButton press.
Regards,
George
[toc] | [prev] | [next] | [standalone]
| From | Massimo Bighelli <info@arcasistemi.it> |
|---|---|
| Date | 2013-04-15 21:15 +0200 |
| Message-ID | <kkhjjl$ob2$1@speranza.aioe.org> |
| In reply to | #5062 |
George
looking at your Init()
you have a OKButton
set it as "default" in the IDE
*Massimo Bighelli* ARCA Sistemi S.r.l.
Il 15/04/2013 21:09, BGeorge ha scritto:
> Hi Carlos,
> I used your Method Dispatch but nothing happend.
>
> CLASS anagnorisi INHERIT DIALOGWINDOW
>
> PROTECT oDCFixedText1 AS FIXEDTEXT
> PROTECT oDCFixedText2 AS FIXEDTEXT
> PROTECT oDCSingleLineEdit1 AS SINGLELINEEDIT
> PROTECT oDCSingleLineEdit2 AS SINGLELINEEDIT
> PROTECT oCCOkButton AS PUSHBUTTON
> PROTECT oCCCancelButton AS PUSHBUTTON
>
>
> METHOD Init(oParent,uExtra) CLASS anagnorisi
> LOCAL DIM aFonts[2] AS OBJECT
> LOCAL DIM aBrushes[1] AS OBJECT
>
> SELF:PreInit(oParent,uExtra)
>
> SUPER:Init(oParent,ResourceID{"anagnorisi",_GetInst()},TRUE)
>
> aFonts[1] := Font{,9,"Courier New"}
> aFonts[1]:Bold := TRUE
> aFonts[2] := Font{,12,"Courier New"}
> aFonts[2]:Bold := TRUE
> aBrushes[1] := Brush{Color{255,255,255}}
>
> oDCFixedText1 := FixedText{SELF,ResourceID{ANAGNORISI_FIXEDTEXT1,_GetInst()}}
> oDCFixedText1:HyperLabel := HyperLabel{#FixedText1,"Username:",NULL_STRING,NULL_STRING}
> oDCFixedText1:BackGround := aBrushes[1]
>
> oDCFixedText2 := FixedText{SELF,ResourceID{ANAGNORISI_FIXEDTEXT2,_GetInst()}}
> oDCFixedText2:HyperLabel := HyperLabel{#FixedText2,"Password:",NULL_STRING,NULL_STRING}
> oDCFixedText2:BackGround := aBrushes[1]
>
> oDCSingleLineEdit1 := SingleLineEdit{SELF,ResourceID{ANAGNORISI_SINGLELINEEDIT1,_GetInst()}}
> oDCSingleLineEdit1:HyperLabel := HyperLabel{#SingleLineEdit1,NULL_STRING,NULL_STRING,NULL_STRING}
> oDCSingleLineEdit1:Font(aFonts[1], FALSE)
> oDCSingleLineEdit1:TextLimit := 5
>
> oDCSingleLineEdit2 := SingleLineEdit{SELF,ResourceID{ANAGNORISI_SINGLELINEEDIT2,_GetInst()}}
> oDCSingleLineEdit2:HyperLabel := HyperLabel{#SingleLineEdit2,NULL_STRING,NULL_STRING,NULL_STRING}
> oDCSingleLineEdit2:Font(aFonts[2], FALSE)
> oDCSingleLineEdit2:TextLimit := 8
>
> oCCOkButton := PushButton{SELF,ResourceID{ANAGNORISI_OKBUTTON,_GetInst()}}
> oCCOkButton:HyperLabel := HyperLabel{#OkButton,"OK",NULL_STRING,NULL_STRING}
>
> oCCCancelButton := PushButton{SELF,ResourceID{ANAGNORISI_CANCELBUTTON,_GetInst()}}
> oCCCancelButton:HyperLabel := HyperLabel{#CancelButton,"¢êõñï",NULL_STRING,NULL_STRING}
>
> SELF:Caption := "Áíáãíþñçóç"
> SELF:HyperLabel := HyperLabel{#anagnorisi,"Áíáãíþñçóç",NULL_STRING,NULL_STRING}
> SELF:ClipperKeys := TRUE
>
> SELF:PostInit(oParent,uExtra)
>
> RETURN SELF
>
> METHOD OkButton( ) CLASS anagnorisi
> //search in file of users for username and password
> IF Found()
> Done:=TRUE
> ELSE
> Done:=FALSE
> SELF:EndDialog()
>
> METHOD CancelButton class anagnorisi
> Done:=FALSE
> SELF:EndDialog()
>
> That i want to do is when i am in singlelineedit2(password) after give the password and press enter i want to do OkButton press.
>
> Regards,
> George
>
[toc] | [prev] | [next] | [standalone]
| From | BGeorge <bgeorge21@in.gr> |
|---|---|
| Date | 2013-04-15 12:22 -0700 |
| Message-ID | <4be03adc-5c7f-491f-9196-6bef698f0e92@googlegroups.com> |
| In reply to | #5063 |
Carlos, Sorry I forgot to write. RESOURCE anagnorisi DIALOGEX 33, 49, 167, 61 STYLE DS_3DLOOK|DS_MODALFRAME|DS_CENTER|WS_POPUP|WS_CAPTION|WS_SYSMENU CAPTION "Áíáãíþñçóç" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Username:", ANAGNORISI_FIXEDTEXT1, "Static", WS_CHILD, 2, 2, 48, 12, WS_EX_CLIENTEDGE|WS_EX_RIGHT CONTROL "Password:", ANAGNORISI_FIXEDTEXT2, "Static", WS_CHILD, 2, 17, 48, 12, WS_EX_CLIENTEDGE|WS_EX_RIGHT CONTROL "", ANAGNORISI_SINGLELINEEDIT1, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 51, 2, 109, 12, WS_EX_CLIENTEDGE CONTROL "", ANAGNORISI_SINGLELINEEDIT2, "Edit", ES_AUTOHSCROLL|ES_PASSWORD|WS_TABSTOP|WS_CHILD|WS_BORDER, 51, 17, 109, 12, WS_EX_CLIENTEDGE CONTROL "OK", ANAGNORISI_OKBUTTON, "Button", BS_DEFPUSHBUTTON|WS_TABSTOP|WS_CHILD, 28, 41, 39, 13 CONTROL "Cancel", ANAGNORISI_CANCELBUTTON, "Button", WS_CHILD, 102, 41, 40, 13 END
[toc] | [prev] | [next] | [standalone]
| From | Carlos Rocha <jazzda1307@gmail.com> |
|---|---|
| Date | 2013-04-15 13:45 -0700 |
| Message-ID | <ff55bd01-659f-4122-87ce-48ffc65ad2f5@googlegroups.com> |
| In reply to | #5062 |
George, Sorry to ask, but did you change the method declaration? METHOD Dispatch(oEvent) CLASS anagnorisi Carlos
[toc] | [prev] | [next] | [standalone]
| From | BGeorge <bgeorge21@in.gr> |
|---|---|
| Date | 2013-04-15 14:10 -0700 |
| Message-ID | <e01ecc57-77b5-417d-be49-42d43c601c64@googlegroups.com> |
| In reply to | #5065 |
Carlos, Youy method is METHOD Dispatch(oEvent) CLASS OkCancelDlg and CLASS OkCancelDlg INHERIT DIALOGWINDOW Is this correctly? I have a dialogwindow with name "anagnorisi" in greece means recognition. In your program the dispatch method works like i said (after singlelineedit press enter and do the OkButton) correctly? Regards, George
[toc] | [prev] | [next] | [standalone]
| From | Carlos Rocha <jazzda1307@gmail.com> |
|---|---|
| Date | 2013-04-15 15:22 -0700 |
| Message-ID | <d21aa542-1783-4e6a-8022-a6cf1445e619@googlegroups.com> |
| In reply to | #5066 |
On Monday, April 15, 2013 10:10:24 PM UTC+1, BGeorge wrote: > Carlos, > > Youy method is > METHOD Dispatch(oEvent) CLASS OkCancelDlg > and > CLASS OkCancelDlg INHERIT DIALOGWINDOW > Is this correctly? > > I have a dialogwindow with name "anagnorisi" in greece means recognition. > > In your program the dispatch method works like i said (after singlelineedit press enter and do the OkButton) correctly? > Ok, just checking :) It works like I said (I just checked with a new dialog): If the user press ESC and the method CancelButton exist it is executed, otherwise EndDialog(0) is called. If the user press ENTER and the method OkButton exist it is executed, otherwise EndDialog(1) is called. This is all my code, along with the Dispatch method I posted: CLASS OkCancelDlg INHERIT DialogWindow Then I inherit my dialogs from OkCancelDialog class instead of DialogWindow in the window editor (DlgWindow tab in "Dialog Window Properties"). You must check if the password field has focus when the key is pressed: METHOD IsFocus() CLASS Control RETURN SELF:Handle() == GetFocus() and inside the Dispatch you can use oDCSingleLineEdit2:IsFocus() to check it. Carlos
[toc] | [prev] | [next] | [standalone]
| From | BGeorge <bgeorge21@in.gr> |
|---|---|
| Date | 2013-04-15 22:29 -0700 |
| Message-ID | <aaf52f29-3a91-44fc-80d7-389cca2bbd7d@googlegroups.com> |
| In reply to | #5067 |
Carlos, Thank you for your help. I checked all and the singlelineedit has focus. I run the program under debugger and i checked. That I noticed is in the line "ELSEIF oEvent:wParam == 1 // Return pressed" never is true, i don't know why. when i press Escape then the code runs ok I have VO 2.5 Thanks again Regards, George
[toc] | [prev] | [next] | [standalone]
| From | Carlos Rocha <jazzda1307@gmail.com> |
|---|---|
| Date | 2013-04-15 22:45 -0700 |
| Message-ID | <a361a5bc-e79d-45f2-82b5-2f7d529cc561@googlegroups.com> |
| In reply to | #5068 |
George, I'm with 2.8 SP4, but the code is working since 2.6 What's the value of wParam when you press Enter or Return key? find it and replace 1 with that value. Carlos
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web