INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Override _SCREEN Methods

Override _SCREEN Methods

(OP)
Hi everybody,

I'd like to Override _SCREEN Events for example: Init(), Load(), Unload(), Custom Methods, etc.

I can do it in a Form like this:

CODE --> VFP

oForm = CreateObject("MyForm")
oForm.Show(1)
Release oForm

DEFINE CLASS MyForm AS Form

   PROCEDURE Init
      ? "M├ętodo Init Sobreescrito"
   ENDPROC
ENDDEFINE 

but, how can I do it on _SCREEN?, I suppose the answer is BINDEVENTS() but I cant make it work.

I found this sample on VFP file help:

CODE --> VFP

PUBLIC oHandler
oHandler=NEWOBJECT("myhandler")
DO (_browser)
BINDEVENT(_SCREEN,"Resize",oHandler,"myresize")

DEFINE CLASS myhandler AS Session
   PROCEDURE myresize
      IF ISNULL(_obrowser) THEN
         UNBINDEVENTS(THIS)
      ELSE
         _obrowser.left = _SCREEN.Width - _obrowser.width
      ENDIF
   RETURN
ENDDEFINE 

Thanks for your help...!



RE: Override _SCREEN Methods

May I ask WHY you want to do this? In an exe most programmers simply hide _screen, and never show it. That's why we have Screen=Off in our config.fpw which are included in our projects. A visible _screen is only used for development.

RE: Override _SCREEN Methods

(OP)
I'm creating a new Ribbon builder for developers but some friends of mine uses _SCREEN instead of Top Level Form, so I must to switch between Top Level Form and _SCREEN for flexibilities.

Thanks...!

RE: Override _SCREEN Methods

I found this code in my box of goodies, maybe it will give you some help.

Public ox
m.ox = Newobject([myformx])
Bindevent(_Screen, [resize], m.ox, [resize])
m.ox.Show
Define Class myformx As Form
   Add Object txtURL As TextBox With Width = 400, Value = [www.msn.com], Autocomplete = 3
   Add Object cmdRefresh As CommandButton With Caption = [\<Refresh], Left = 400, Height = 20
   Add Object cmdBack As CommandButton With Caption = [\<Back], Left = 475, Height = 20
   Add Object cmdForward As CommandButton With Caption = [\<Forward], Left = 550, Height = 20
   Add Object oweb As cweb With Top = 30
      Width = 800
      Height = 800
      AlwaysOnBottom = .T.
      AllowOutput = .F.
      TitleBar = 0
   Procedure Init
      This.oweb.Width = Thisform.Width
      Thisform.Resize
      This.oweb.Height = Thisform.Height - Thisform.txtURL.Height - 2
      Thisform.txtURL.Valid
   Procedure Resize
      Thisform.Width = _Screen.Width
      Thisform.Height = _Screen.Height
      This.oweb.Top = 30
      This.oweb.Height = Thisform.Height - 100
      This.oweb.Width = Thisform.Width - Thisform.Left
   Procedure txtURL.Valid
      Thisform.oweb.Navigate(This.Value)
      Procedure cmdRefresh.Click
      Thisform.oweb.Refresh
   Procedure cmdBack.Click
      Try
         Thisform.oweb.GoBack()
      Catch
      Endtry
   Procedure cmdForward.Click
      Try
         Thisform.oweb.GoForward()
      Catch
      Endtry
Enddefine

Define Class cweb As OleControl
   OleClass = [shell.explorer.2]
   Procedure Refresh
      Nodefault
 

RE: Override _SCREEN Methods

(OP)
Great, checking the example...!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close