Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

GUI Help
What am I doing wrong? Small pogram to change temperature C to F
Demonstrating, enter value into editbox1(ED1) when onclick OK
button,converts to Farenheit,
and places the result on editbox2(ED2). Closing the Gui is no problem

[1] Temp;V
[2]
[3] 'ff' {quad} 'Delete'
[4] 'ff' {quad}wi 'Create' 'Form'
[5] 'ff.bnOK' {quad}wi 'New' 'Button'
[6] 'ff.bnOK' {quad}wi 'caption' 'OK'
[7] 'ff.bnOK' {quad}wi 'where' 2 45
[8] 'ff.bnOK' {quad}wi 'onClick' 'ff.bnOK.Click'
[9]
[10] 'ff.bnCancel' {quad}wi 'New' 'Button'('caption' 'Cancel')('where' 8 45)
('style' 2)
]11]
[12] 'ff.Lb1' {quad}wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
[13] 'ff.ED1' {quad}wi 'New' 'Edit' ('where' 5 20)
[14] 'ff.Lb2' {quad}wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
[15] 'ff.ED2' {quad}wi 'New' 'Edit' ('where' 10 20)
[16]
[17] 'ff.bnOk.Click' {quad}wi 'value'(V<-'ff.ED1'{quad}wi'text')
[18] 'ff.ED1' {quad}wi 'text' ({Thorn}V)
[19] 'ff.ED2' {quad}wi 'text'({Thorn}32+V󭝵)

Any help would be appreciated. I am using Apl+Win 4.0
With Thanks
Steve



Report this thread to moderator Post Follow-up to this message
Old Post
smandula
10-21-04 08:55 AM


Re: GUI Help
Modifying your code to make it work, here is a solution.
{del} Temp;V
[1]
[2]   'ff' #wi 'Create' 'Form'
[3]   'ff.bnOK' #wi 'New' 'Button'
[4]   'ff.bnOK' #wi 'caption' 'OK'
[5]   'ff.bnOK' #wi 'where' 2 45
[6]   'ff.bnOK' #wi 'onClick' "V{<-}#fi 'ff.ED1'#wi'text' & 'ff.ED2' #wi
'text'({format}32+V{times}9{divide}5)"
[7]
[8]   'ff.bnCancel' #wi 'New' 'Button'('caption' 'Cancel')('where' 8
45)('style' 2)
[9]
[10]  'ff.Lb1' #wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
[11]  'ff.ED1' #wi 'New' 'Edit' ('where' 5 20)
[12]  'ff.Lb2' #wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
[13]  'ff.ED2' #wi 'New' 'Edit' ('where' 10 20)
{del}

Note -your onClick handler needs to be valid code or a function that is run
when the Click event fires.



"smandula" <smandula@idirect.com> wrote in message
news:qvadnSU5NJTSuOrcRVn-pA@look.ca...
> What am I doing wrong? Small pogram to change temperature C to F
> Demonstrating, enter value into editbox1(ED1) when onclick OK
> button,converts to Farenheit,
> and places the result on editbox2(ED2). Closing the Gui is no problem
>
> [1] Temp;V
> [2]
> [3] 'ff' {quad} 'Delete'
> [4] 'ff' {quad}wi 'Create' 'Form'
> [5] 'ff.bnOK' {quad}wi 'New' 'Button'
> [6] 'ff.bnOK' {quad}wi 'caption' 'OK'
> [7] 'ff.bnOK' {quad}wi 'where' 2 45
> [8] 'ff.bnOK' {quad}wi 'onClick' 'ff.bnOK.Click'
> [9]
> [10] 'ff.bnCancel' {quad}wi 'New' 'Button'('caption' 'Cancel')('where' 8
45)
> ('style' 2)
> ]11]
> [12] 'ff.Lb1' {quad}wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
> [13] 'ff.ED1' {quad}wi 'New' 'Edit' ('where' 5 20)
> [14] 'ff.Lb2' {quad}wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
> [15] 'ff.ED2' {quad}wi 'New' 'Edit' ('where' 10 20)
> [16]
> [17] 'ff.bnOk.Click' {quad}wi 'value'(V<-'ff.ED1'{quad}wi'text')
> [18] 'ff.ED1' {quad}wi 'text' ({Thorn}V)
> [19] 'ff.ED2' {quad}wi 'text'({Thorn}32+V󭝵)
>
> Any help would be appreciated. I am using Apl+Win 4.0
> With Thanks
> Steve
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
LatLong
10-21-04 08:55 AM


Re: GUI Help
Steve,

Your question has already been answered in coding terms. I would recommend
as a
matter of style you write all your handlers as functions. In your example I
would name them Convert and Cancel. In this way having developed your form
layout and basic functionality you can then add functionality by developing
the handler functions without having to touch the form coding. For example
it would be easy to make Convert go either way depending on which box your
user input a value. You could then add error trapping if no value was
entered. Similarly you could control what happened when you user cancels the
form.

Graham.
"smandula" <smandula@idirect.com> wrote in message
news:qvadnSU5NJTSuOrcRVn-pA@look.ca...
> What am I doing wrong? Small pogram to change temperature C to F
> Demonstrating, enter value into editbox1(ED1) when onclick OK
> button,converts to Farenheit,
> and places the result on editbox2(ED2). Closing the Gui is no problem
>
> [1] Temp;V
> [2]
> [3] 'ff' {quad} 'Delete'
> [4] 'ff' {quad}wi 'Create' 'Form'
> [5] 'ff.bnOK' {quad}wi 'New' 'Button'
> [6] 'ff.bnOK' {quad}wi 'caption' 'OK'
> [7] 'ff.bnOK' {quad}wi 'where' 2 45
> [8] 'ff.bnOK' {quad}wi 'onClick' 'ff.bnOK.Click'
> [9]
> [10] 'ff.bnCancel' {quad}wi 'New' 'Button'('caption' 'Cancel')('where' 8
45)
> ('style' 2)
> ]11]
> [12] 'ff.Lb1' {quad}wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
> [13] 'ff.ED1' {quad}wi 'New' 'Edit' ('where' 5 20)
> [14] 'ff.Lb2' {quad}wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
> [15] 'ff.ED2' {quad}wi 'New' 'Edit' ('where' 10 20)
> [16]
> [17] 'ff.bnOk.Click' {quad}wi 'value'(V<-'ff.ED1'{quad}wi'text')
> [18] 'ff.ED1' {quad}wi 'text' ({Thorn}V)
> [19] 'ff.ED2' {quad}wi 'text'({Thorn}32+V󭝵)
>
> Any help would be appreciated. I am using Apl+Win 4.0
> With Thanks
> Steve
>
>




Report this thread to moderator Post Follow-up to this message
Old Post
Graham Steer
10-21-04 08:55 PM


Re: GUI Help
In article <1098362850.19508.0@spandrell.news.uk.clara.net>, "Graham
Steer" <graham@runsell.clara.co.uk> wrote:

>Your question has already been answered in coding terms. I would recommend
>as a
>matter of style you write all your handlers as functions. In your example I
>would name them Convert and Cancel. In this way having developed your form
>layout and basic functionality you can then add functionality by developing
>the handler functions without having to touch the form coding. For example
>it would be easy to make Convert go either way depending on which box your
>user input a value. You could then add error trapping if no value was
>entered. Similarly you could control what happened when you user cancels th
e
>form.

A minor digression regarding Graham's suggestion as to style, which is
certainly sound...

..and is undoubtedly the best way to structure a simple application
with one form, or perhaps just a few fairly simple ones.

My experience with writing complex applications with a large number of
forms, however, is that maintainability is better served by writing not
one function for each handler, but one function for each form, with the
individual handlers as :CASE statements (or the equivalent in other than
APL+Win) selected by a descriptively named argument.  If those functions
are consistently named (<formname>_Handlers or the like), someone new to
the code will know in which function to find the handler for any control
on any form without even having to look at the function list.

Eric Landau, APL Solutions, Inc.
"Sacred cows make the tastiest hamburger." - Abbie Hoffman

Report this thread to moderator Post Follow-up to this message
Old Post
Eric Landau
10-21-04 08:55 PM


Re: GUI Help
www.jsoftware.com

--------------- script from J Primer
NB. base form

CFGUI=: 0 : 0
pc cfgui;
xywh 12 18 40 10;cc ccstatic static;cn "centigrade:";
xywh 56 16 40 14;cc cid edit ws_border es_autohscroll;
xywh 12 40 40 10;cc ccstatic static;cn "Fahrenheit:";
xywh 56 36 40 14;cc fid edit ws_border es_autohscroll;
pas 6 6;pcenter;
rem form end;
)

cfgui_run=: 3 : 0
wd CFGUI
NB. initialize form here
wd 'pshow;'
)

cfgui_close=: 3 : 0
wd'pclose'
)

cfgui_cid_button=: 3 : 0
t =. 0 ". cid
t =. fahrenheit t
t =. ": t
wd 'set fid *', t
)

cfgui_close_button=: 3 : 0
wd 'pclose'
)

g1=: %&1.8
g3=: -&32
g5=: g1@g3
g6=: g5^:_1

fahrenheit=:3 : 0
g5 y.
)

centigrade=:3 : 0
g6 y.
)

cfgui_fid_button=: 3 : 0
t =. 0 ". fid
t =. centigrade t
t =. ": t
wd 'set cid *', t
)

cfgui_run 0

Report this thread to moderator Post Follow-up to this message
Old Post
Bj?rn Helgason
10-21-04 08:55 PM


Re: GUI Help
Modifying your code to make it work, here is a solution.
{del} Temp;V
[1]
[2]   'ff' #wi 'Create' 'Form'
[3]   'ff.bnOK' #wi 'New' 'Button'
[4]   'ff.bnOK' #wi 'caption' 'OK'
[5]   'ff.bnOK' #wi 'where' 2 45
[6]   'ff.bnOK' #wi 'onClick' "V{<-}#fi 'ff.ED1'#wi'text' & 'ff.ED2' #wi
'text'({format}32+V{times}9{divide}5)"
[7]
[8]   'ff.bnCancel' #wi 'New' 'Button'('caption' 'Cancel')('where' 8
45)('style' 2)
[9]
[10]  'ff.Lb1' #wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
[11]  'ff.ED1' #wi 'New' 'Edit' ('where' 5 20)
[12]  'ff.Lb2' #wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
[13]  'ff.ED2' #wi 'New' 'Edit' ('where' 10 20)
{del}

Note -your onClick handler needs to be valid code or a function that is run
when the Click event fires.



"smandula" <smandula@idirect.com> wrote in message
news:qvadnSU5NJTSuOrcRVn-pA@look.ca...
> What am I doing wrong? Small pogram to change temperature C to F
> Demonstrating, enter value into editbox1(ED1) when onclick OK
> button,converts to Farenheit,
> and places the result on editbox2(ED2). Closing the Gui is no problem
>
> [1] Temp;V
> [2]
> [3] 'ff' {quad} 'Delete'
> [4] 'ff' {quad}wi 'Create' 'Form'
> [5] 'ff.bnOK' {quad}wi 'New' 'Button'
> [6] 'ff.bnOK' {quad}wi 'caption' 'OK'
> [7] 'ff.bnOK' {quad}wi 'where' 2 45
> [8] 'ff.bnOK' {quad}wi 'onClick' 'ff.bnOK.Click'
> [9]
> [10] 'ff.bnCancel' {quad}wi 'New' 'Button'('caption' 'Cancel')('where' 8
45)
> ('style' 2)
> ]11]
> [12] 'ff.Lb1' {quad}wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
> [13] 'ff.ED1' {quad}wi 'New' 'Edit' ('where' 5 20)
> [14] 'ff.Lb2' {quad}wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
> [15] 'ff.ED2' {quad}wi 'New' 'Edit' ('where' 10 20)
> [16]
> [17] 'ff.bnOk.Click' {quad}wi 'value'(V<-'ff.ED1'{quad}wi'text')
> [18] 'ff.ED1' {quad}wi 'text' ({Thorn}V)
> [19] 'ff.ED2' {quad}wi 'text'({Thorn}32+V󭝵)
>
> Any help would be appreciated. I am using Apl+Win 4.0
> With Thanks
> Steve
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
LatLong
10-26-04 01:55 PM


Re: GUI Help
Steve,

Your question has already been answered in coding terms. I would recommend
as a
matter of style you write all your handlers as functions. In your example I
would name them Convert and Cancel. In this way having developed your form
layout and basic functionality you can then add functionality by developing
the handler functions without having to touch the form coding. For example
it would be easy to make Convert go either way depending on which box your
user input a value. You could then add error trapping if no value was
entered. Similarly you could control what happened when you user cancels the
form.

Graham.
"smandula" <smandula@idirect.com> wrote in message
news:qvadnSU5NJTSuOrcRVn-pA@look.ca...
> What am I doing wrong? Small pogram to change temperature C to F
> Demonstrating, enter value into editbox1(ED1) when onclick OK
> button,converts to Farenheit,
> and places the result on editbox2(ED2). Closing the Gui is no problem
>
> [1] Temp;V
> [2]
> [3] 'ff' {quad} 'Delete'
> [4] 'ff' {quad}wi 'Create' 'Form'
> [5] 'ff.bnOK' {quad}wi 'New' 'Button'
> [6] 'ff.bnOK' {quad}wi 'caption' 'OK'
> [7] 'ff.bnOK' {quad}wi 'where' 2 45
> [8] 'ff.bnOK' {quad}wi 'onClick' 'ff.bnOK.Click'
> [9]
> [10] 'ff.bnCancel' {quad}wi 'New' 'Button'('caption' 'Cancel')('where' 8
45)
> ('style' 2)
> ]11]
> [12] 'ff.Lb1' {quad}wi 'New' 'Label' ('caption' 'Celsius')('where' 3 20)
> [13] 'ff.ED1' {quad}wi 'New' 'Edit' ('where' 5 20)
> [14] 'ff.Lb2' {quad}wi 'New' 'Label' ('caption' 'Farenheit')('where' 8 20)
> [15] 'ff.ED2' {quad}wi 'New' 'Edit' ('where' 10 20)
> [16]
> [17] 'ff.bnOk.Click' {quad}wi 'value'(V<-'ff.ED1'{quad}wi'text')
> [18] 'ff.ED1' {quad}wi 'text' ({Thorn}V)
> [19] 'ff.ED2' {quad}wi 'text'({Thorn}32+V󭝵)
>
> Any help would be appreciated. I am using Apl+Win 4.0
> With Thanks
> Steve
>
>




Report this thread to moderator Post Follow-up to this message
Old Post
Graham Steer
10-26-04 08:55 PM


Re: GUI Help
In article <1098362850.19508.0@spandrell.news.uk.clara.net>, "Graham
Steer" <graham@runsell.clara.co.uk> wrote:

>Your question has already been answered in coding terms. I would recommend
>as a
>matter of style you write all your handlers as functions. In your example I
>would name them Convert and Cancel. In this way having developed your form
>layout and basic functionality you can then add functionality by developing
>the handler functions without having to touch the form coding. For example
>it would be easy to make Convert go either way depending on which box your
>user input a value. You could then add error trapping if no value was
>entered. Similarly you could control what happened when you user cancels th
e
>form.

A minor digression regarding Graham's suggestion as to style, which is
certainly sound...

..and is undoubtedly the best way to structure a simple application
with one form, or perhaps just a few fairly simple ones.

My experience with writing complex applications with a large number of
forms, however, is that maintainability is better served by writing not
one function for each handler, but one function for each form, with the
individual handlers as :CASE statements (or the equivalent in other than
APL+Win) selected by a descriptively named argument.  If those functions
are consistently named (<formname>_Handlers or the like), someone new to
the code will know in which function to find the handler for any control
on any form without even having to look at the function list.

Eric Landau, APL Solutions, Inc.
"Sacred cows make the tastiest hamburger." - Abbie Hoffman

Report this thread to moderator Post Follow-up to this message
Old Post
Eric Landau
10-26-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

APL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:54 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.