Hi all!

I´m struggling with my code for automatic adaptation to different
screenresolutions. Can someone give me a hint about what is wrong. An
editbox does not keep its proportional placing when changing the
screenresolution.

I have made it simple for you, just copy and paste as below.

Any help would be very appreciated.

Regards
Christina



Give an empty form
- two propertys (pyHeightratio and pyWidthratio)
- a methode (mdResizecontrols)



* COPY THE CODE BELOW INTO THE FORMS INIT:
* the form itself
this.Width = 400
this.height = 200

* the bottompageframe
WITH This
.addobject('bottomPgFr','pageframe')
.bottomPgFr.top = 0
.bottomPgFr.height = this.height
.bottomPgFr.width = this.width
.bottomPgFr.pagecount = 2
ENDWITH

* the toppageframe inside the bottompageframe´s page 1
WITH This.bottomPgFr.page1
.addobject('topPgFr','pageframe')
.topPgFr.top = 0
.topPgFr.height = This.bottomPgFr.pageheight
.topPgFr.width = This.bottomPgFr.width
.topPgFr.pagecount = 2
ENDWITH

* an editbox inside the toppageframe´s page 1
WITH This.bottomPgFr.page1.topPgFr
.page1.addobject('edtNote','Editbox')
.page1.edtNote.height = 70
.page1.edtNote.width = .Width/2
.page1.edtNote.left = .Width/2
.page1.edtNote.top = .pageheight - .page1.edtNote.height
ENDWITH

* make all added objects visible
WITH This.bottomPgFr
.visible = .T.
.page1.topPgFr.visible = .T.
.page1.topPgFr.page1.edtNote.visible = .T.
ENDWITH

* code for different screenresolutions (form designed in 800x600)
this.pyHeightRatio = SYSMETRIC( 2 ) / 600
this.pyWidthRatio = SYSMETRIC( 1 ) / 800
this.height = this.height * this.pyHeightRatio
this.width = this.width * this.pywidthRatio

LOCAL loControl

FOR EACH loControl IN Thisform.Controls
Thisform.mdResizeControls(loControl)
ENDFOR








* COPY THE CODE BELOW INTO THE FORMS METHODE MDRESIZECONTROLS:
LPARAMETERS toControl
LOCAL loPage, loControl

IF PEMSTATUS( toControl, 'Width', 5 )
toControl.Width = toControl.Width * Thisform.pyWidthRatio
ENDIF

IF PEMSTATUS( toControl, 'Height', 5 )
toControl.Height = toControl.Height * Thisform.pyHeightRatio
ENDIF

IF PEMSTATUS( toControl, 'Top', 5 )
toControl.Top = toControl.Top * Thisform.pyHeightRatio
ENDIF

IF PEMSTATUS( toControl, 'Left', 5 )
toControl.Left = toControl.Left * Thisform.pyHeightRatio
ENDIF

IF PEMSTATUS( toControl, 'Fontsize', 5 )
toControl.Fontsize = INT( toControl.FontSize * Thisform.pyWidthRatio )
ENDIF

DO CASE
CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGEFRAME'
FOR EACH loPage IN toControl.Pages
Thisform.mdResizeControls( loPage )
ENDFOR
CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGE'
FOR EACH loControl IN toControl.Controls
Thisform.mdResizeControls( loControl )
ENDFOR
ENDCASE


** PS
** Gregory I know you have solved this before but the solution is gone - a
disccrash
** DS

Re: Automatic adaptation to different screenresolutions by Gregory

Gregory
Wed Nov 26 02:07:26 CST 2003

Christina,

Click the link below. If it does not work do a google search
word: pyHeightratio
group: *fox*

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=KBOua.7764%24dP1.13300%40newsc.telia.net&rnum=2&prev=/groups%3Fas_q%3DpyHeightRatio%26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_ugroup%3D*fox*%26lr%3D%26hl%3Den

Cheers,

Gregory
______________________

"Ch Löfberg" <ch.lofberg@telia.com> wrote in message
news:cFTwb.35351$mU6.120532@newsb.telia.net...
> Hi all!
>
> I´m struggling with my code for automatic adaptation to different
> screenresolutions. Can someone give me a hint about what is wrong. An
> editbox does not keep its proportional placing when changing the
> screenresolution.
>
> I have made it simple for you, just copy and paste as below.
>
> Any help would be very appreciated.
>
> Regards
> Christina
>
>
>
> Give an empty form
> - two propertys (pyHeightratio and pyWidthratio)
> - a methode (mdResizecontrols)
>
>
>
> * COPY THE CODE BELOW INTO THE FORMS INIT:
> * the form itself
> this.Width = 400
> this.height = 200
>
> * the bottompageframe
> WITH This
> .addobject('bottomPgFr','pageframe')
> .bottomPgFr.top = 0
> .bottomPgFr.height = this.height
> .bottomPgFr.width = this.width
> .bottomPgFr.pagecount = 2
> ENDWITH
>
> * the toppageframe inside the bottompageframe´s page 1
> WITH This.bottomPgFr.page1
> .addobject('topPgFr','pageframe')
> .topPgFr.top = 0
> .topPgFr.height = This.bottomPgFr.pageheight
> .topPgFr.width = This.bottomPgFr.width
> .topPgFr.pagecount = 2
> ENDWITH
>
> * an editbox inside the toppageframe´s page 1
> WITH This.bottomPgFr.page1.topPgFr
> .page1.addobject('edtNote','Editbox')
> .page1.edtNote.height = 70
> .page1.edtNote.width = .Width/2
> .page1.edtNote.left = .Width/2
> .page1.edtNote.top = .pageheight - .page1.edtNote.height
> ENDWITH
>
> * make all added objects visible
> WITH This.bottomPgFr
> .visible = .T.
> .page1.topPgFr.visible = .T.
> .page1.topPgFr.page1.edtNote.visible = .T.
> ENDWITH
>
> * code for different screenresolutions (form designed in 800x600)
> this.pyHeightRatio = SYSMETRIC( 2 ) / 600
> this.pyWidthRatio = SYSMETRIC( 1 ) / 800
> this.height = this.height * this.pyHeightRatio
> this.width = this.width * this.pywidthRatio
>
> LOCAL loControl
>
> FOR EACH loControl IN Thisform.Controls
> Thisform.mdResizeControls(loControl)
> ENDFOR
>
>
>
>
>
>
>
>
> * COPY THE CODE BELOW INTO THE FORMS METHODE MDRESIZECONTROLS:
> LPARAMETERS toControl
> LOCAL loPage, loControl
>
> IF PEMSTATUS( toControl, 'Width', 5 )
> toControl.Width = toControl.Width * Thisform.pyWidthRatio
> ENDIF
>
> IF PEMSTATUS( toControl, 'Height', 5 )
> toControl.Height = toControl.Height * Thisform.pyHeightRatio
> ENDIF
>
> IF PEMSTATUS( toControl, 'Top', 5 )
> toControl.Top = toControl.Top * Thisform.pyHeightRatio
> ENDIF
>
> IF PEMSTATUS( toControl, 'Left', 5 )
> toControl.Left = toControl.Left * Thisform.pyHeightRatio
> ENDIF
>
> IF PEMSTATUS( toControl, 'Fontsize', 5 )
> toControl.Fontsize = INT( toControl.FontSize * Thisform.pyWidthRatio )
> ENDIF
>
> DO CASE
> CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGEFRAME'
> FOR EACH loPage IN toControl.Pages
> Thisform.mdResizeControls( loPage )
> ENDFOR
> CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGE'
> FOR EACH loControl IN toControl.Controls
> Thisform.mdResizeControls( loControl )
> ENDFOR
> ENDCASE
>
>
> ** PS
> ** Gregory I know you have solved this before but the solution is gone - a
> disccrash
> ** DS
>
>


Re: Automatic adaptation to different screenresolutions by Ch

Ch
Thu Nov 27 03:53:08 CST 2003

Hi Gregory!

Thank you for the adwise Gegory! I didn´t know that Google is so interested
of us. Now I realize we are much more important than I knew before:-).

Regards Christina


"Gregory Adam" <GregoryAdam@PleaseReplyViaNewsGroup.com> skrev i meddelandet
news:e1C9YS$sDHA.536@tk2msftngp13.phx.gbl...
> Christina,
>
> Click the link below. If it does not work do a google search
> word: pyHeightratio
> group: *fox*
>
>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=KBOua.77
64%24dP1.13300%40newsc.telia.net&rnum=2&prev=/groups%3Fas_q%3DpyHeightRatio%
26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_ugroup%3D*fox*%26lr%3D%26hl%3
Den
>
> Cheers,
>
> Gregory
> ______________________
>
> "Ch Löfberg" <ch.lofberg@telia.com> wrote in message
> news:cFTwb.35351$mU6.120532@newsb.telia.net...
> > Hi all!
> >
> > I´m struggling with my code for automatic adaptation to different
> > screenresolutions. Can someone give me a hint about what is wrong. An
> > editbox does not keep its proportional placing when changing the
> > screenresolution.
> >
> > I have made it simple for you, just copy and paste as below.
> >
> > Any help would be very appreciated.
> >
> > Regards
> > Christina
> >
> >
> >
> > Give an empty form
> > - two propertys (pyHeightratio and pyWidthratio)
> > - a methode (mdResizecontrols)
> >
> >
> >
> > * COPY THE CODE BELOW INTO THE FORMS INIT:
> > * the form itself
> > this.Width = 400
> > this.height = 200
> >
> > * the bottompageframe
> > WITH This
> > .addobject('bottomPgFr','pageframe')
> > .bottomPgFr.top = 0
> > .bottomPgFr.height = this.height
> > .bottomPgFr.width = this.width
> > .bottomPgFr.pagecount = 2
> > ENDWITH
> >
> > * the toppageframe inside the bottompageframe´s page 1
> > WITH This.bottomPgFr.page1
> > .addobject('topPgFr','pageframe')
> > .topPgFr.top = 0
> > .topPgFr.height = This.bottomPgFr.pageheight
> > .topPgFr.width = This.bottomPgFr.width
> > .topPgFr.pagecount = 2
> > ENDWITH
> >
> > * an editbox inside the toppageframe´s page 1
> > WITH This.bottomPgFr.page1.topPgFr
> > .page1.addobject('edtNote','Editbox')
> > .page1.edtNote.height = 70
> > .page1.edtNote.width = .Width/2
> > .page1.edtNote.left = .Width/2
> > .page1.edtNote.top = .pageheight - .page1.edtNote.height
> > ENDWITH
> >
> > * make all added objects visible
> > WITH This.bottomPgFr
> > .visible = .T.
> > .page1.topPgFr.visible = .T.
> > .page1.topPgFr.page1.edtNote.visible = .T.
> > ENDWITH
> >
> > * code for different screenresolutions (form designed in 800x600)
> > this.pyHeightRatio = SYSMETRIC( 2 ) / 600
> > this.pyWidthRatio = SYSMETRIC( 1 ) / 800
> > this.height = this.height * this.pyHeightRatio
> > this.width = this.width * this.pywidthRatio
> >
> > LOCAL loControl
> >
> > FOR EACH loControl IN Thisform.Controls
> > Thisform.mdResizeControls(loControl)
> > ENDFOR
> >
> >
> >
> >
> >
> >
> >
> >
> > * COPY THE CODE BELOW INTO THE FORMS METHODE MDRESIZECONTROLS:
> > LPARAMETERS toControl
> > LOCAL loPage, loControl
> >
> > IF PEMSTATUS( toControl, 'Width', 5 )
> > toControl.Width = toControl.Width * Thisform.pyWidthRatio
> > ENDIF
> >
> > IF PEMSTATUS( toControl, 'Height', 5 )
> > toControl.Height = toControl.Height * Thisform.pyHeightRatio
> > ENDIF
> >
> > IF PEMSTATUS( toControl, 'Top', 5 )
> > toControl.Top = toControl.Top * Thisform.pyHeightRatio
> > ENDIF
> >
> > IF PEMSTATUS( toControl, 'Left', 5 )
> > toControl.Left = toControl.Left * Thisform.pyHeightRatio
> > ENDIF
> >
> > IF PEMSTATUS( toControl, 'Fontsize', 5 )
> > toControl.Fontsize = INT( toControl.FontSize *
Thisform.pyWidthRatio )
> > ENDIF
> >
> > DO CASE
> > CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGEFRAME'
> > FOR EACH loPage IN toControl.Pages
> > Thisform.mdResizeControls( loPage )
> > ENDFOR
> > CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGE'
> > FOR EACH loControl IN toControl.Controls
> > Thisform.mdResizeControls( loControl )
> > ENDFOR
> > ENDCASE
> >
> >
> > ** PS
> > ** Gregory I know you have solved this before but the solution is gone -
a
> > disccrash
> > ** DS
> >
> >
>





Re: Automatic adaptation to different screenresolutions by Gregory

Gregory
Thu Nov 27 05:08:49 CST 2003

Hi Christina,

You're welcome ;-)

For any problem I have, I do a google search first. It answers many of them

Gregory
________
"Ch Löfberg" <ch.lofberg@telia.com> wrote in message
news:8Qjxb.39573$dP1.147729@newsc.telia.net...
> Hi Gregory!
>
> Thank you for the adwise Gegory! I didn´t know that Google is so
interested
> of us. Now I realize we are much more important than I knew before:-).
>
> Regards Christina
>
>
> "Gregory Adam" <GregoryAdam@PleaseReplyViaNewsGroup.com> skrev i
meddelandet
> news:e1C9YS$sDHA.536@tk2msftngp13.phx.gbl...
> > Christina,
> >
> > Click the link below. If it does not work do a google search
> > word: pyHeightratio
> > group: *fox*
> >
> >
>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=KBOua.77
>
64%24dP1.13300%40newsc.telia.net&rnum=2&prev=/groups%3Fas_q%3DpyHeightRatio%
>
26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_ugroup%3D*fox*%26lr%3D%26hl%3
> Den
> >
> > Cheers,
> >
> > Gregory
> > ______________________
> >
> > "Ch Löfberg" <ch.lofberg@telia.com> wrote in message
> > news:cFTwb.35351$mU6.120532@newsb.telia.net...
> > > Hi all!
> > >
> > > I´m struggling with my code for automatic adaptation to different
> > > screenresolutions. Can someone give me a hint about what is wrong. An
> > > editbox does not keep its proportional placing when changing the
> > > screenresolution.
> > >
> > > I have made it simple for you, just copy and paste as below.
> > >
> > > Any help would be very appreciated.
> > >
> > > Regards
> > > Christina
> > >
> > >
> > >
> > > Give an empty form
> > > - two propertys (pyHeightratio and pyWidthratio)
> > > - a methode (mdResizecontrols)
> > >
> > >
> > >
> > > * COPY THE CODE BELOW INTO THE FORMS INIT:
> > > * the form itself
> > > this.Width = 400
> > > this.height = 200
> > >
> > > * the bottompageframe
> > > WITH This
> > > .addobject('bottomPgFr','pageframe')
> > > .bottomPgFr.top = 0
> > > .bottomPgFr.height = this.height
> > > .bottomPgFr.width = this.width
> > > .bottomPgFr.pagecount = 2
> > > ENDWITH
> > >
> > > * the toppageframe inside the bottompageframe´s page 1
> > > WITH This.bottomPgFr.page1
> > > .addobject('topPgFr','pageframe')
> > > .topPgFr.top = 0
> > > .topPgFr.height = This.bottomPgFr.pageheight
> > > .topPgFr.width = This.bottomPgFr.width
> > > .topPgFr.pagecount = 2
> > > ENDWITH
> > >
> > > * an editbox inside the toppageframe´s page 1
> > > WITH This.bottomPgFr.page1.topPgFr
> > > .page1.addobject('edtNote','Editbox')
> > > .page1.edtNote.height = 70
> > > .page1.edtNote.width = .Width/2
> > > .page1.edtNote.left = .Width/2
> > > .page1.edtNote.top = .pageheight - .page1.edtNote.height
> > > ENDWITH
> > >
> > > * make all added objects visible
> > > WITH This.bottomPgFr
> > > .visible = .T.
> > > .page1.topPgFr.visible = .T.
> > > .page1.topPgFr.page1.edtNote.visible = .T.
> > > ENDWITH
> > >
> > > * code for different screenresolutions (form designed in 800x600)
> > > this.pyHeightRatio = SYSMETRIC( 2 ) / 600
> > > this.pyWidthRatio = SYSMETRIC( 1 ) / 800
> > > this.height = this.height * this.pyHeightRatio
> > > this.width = this.width * this.pywidthRatio
> > >
> > > LOCAL loControl
> > >
> > > FOR EACH loControl IN Thisform.Controls
> > > Thisform.mdResizeControls(loControl)
> > > ENDFOR
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > * COPY THE CODE BELOW INTO THE FORMS METHODE MDRESIZECONTROLS:
> > > LPARAMETERS toControl
> > > LOCAL loPage, loControl
> > >
> > > IF PEMSTATUS( toControl, 'Width', 5 )
> > > toControl.Width = toControl.Width * Thisform.pyWidthRatio
> > > ENDIF
> > >
> > > IF PEMSTATUS( toControl, 'Height', 5 )
> > > toControl.Height = toControl.Height * Thisform.pyHeightRatio
> > > ENDIF
> > >
> > > IF PEMSTATUS( toControl, 'Top', 5 )
> > > toControl.Top = toControl.Top * Thisform.pyHeightRatio
> > > ENDIF
> > >
> > > IF PEMSTATUS( toControl, 'Left', 5 )
> > > toControl.Left = toControl.Left * Thisform.pyHeightRatio
> > > ENDIF
> > >
> > > IF PEMSTATUS( toControl, 'Fontsize', 5 )
> > > toControl.Fontsize = INT( toControl.FontSize *
> Thisform.pyWidthRatio )
> > > ENDIF
> > >
> > > DO CASE
> > > CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGEFRAME'
> > > FOR EACH loPage IN toControl.Pages
> > > Thisform.mdResizeControls( loPage )
> > > ENDFOR
> > > CASE ALLTRIM(UPPER( toControl.BaseClass )) == 'PAGE'
> > > FOR EACH loControl IN toControl.Controls
> > > Thisform.mdResizeControls( loControl )
> > > ENDFOR
> > > ENDCASE
> > >
> > >
> > > ** PS
> > > ** Gregory I know you have solved this before but the solution is
gone -
> a
> > > disccrash
> > > ** DS
> > >
> > >
> >
>
>
>
>