Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

full description of @... class

Status
Not open for further replies.

SYN

Programmer
Nov 2, 2000
45
NL
Hi,

I'm working at a conversion (from 2.5 to vfp). The main problem is the READ. I know that I can use @... class to make objects which can be used with READ. But I can't find a compleet description of this function.

Can anyone help me?

Willem
 
SYN

It's not clear what you want to do. In FPW the READ was meant to "stop things and wait". Can you explain what you need to do?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

I'm trying to replace the @ say and @ get with the @ class so that i haven't got to switch to read events.
 
SYN

There is no such ting as a READ class. As an example if you create a form and put a textbox on it and in a program you used:
DO FORM myForm.scx
READ EVENTS

That is all you need to do, and you only need to use READ EVENTS once in your whole application (providing it it designed that way.) No normally read events is used as the last line whe your program first loads (it's either a main form or a menu and the read events waits for the user's input).


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

We've got 25 MB source with foxpro 2.5 code!! We've already have 2 user functions who replaces the @ say en @ get. But the whole structure is based on do while en read.
In these user functions I want to create objects with replaces the Gets and which can be used in a READ- environment.
 
SYN

Then you are trying to do a hybrid translation. Most of the time those don't work and if they do they are not worth the amount of efforts involved. You will find in the FoxPro community very little support for hybrid translation. I realize there are 25mb of source; I suggest rewriting the application with OOP in mind to take full advantage of the features available in VFP.

Sorry I guess that is not what you wanted to hear.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

back to my first question: do you have a full description of the @...class command with all parameters?
 
SYN

@...class command with all parameters

If I press F1 in VFP, and type "@" I get :

@ nRow, nColumn CLASS ClassName NAME ObjectName




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
SYN

As an example, if you wanted a combobox on your main screen you could use this:
Code:
Clear
@ 4,2 Class myCombo Name myCombo
Read
Clear
Define Class myCombo As ComboBox
	Procedure Init
	    This.RowSource = "1,2,3,4,5"
	    This.RowSourceType = 1
      Endproc
Enddefine


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

I really hoped that I could use the orginal parameters from @ GET such as VALID, WHEN ect in the @... class.

Thanks for thinking




 
SYN

You can put the valid code in the class you are going to use:
Code:
Clear
@ 4,2 Class myText Name myText
Read
Clear
Define Class myText As Textbox
    Procedure Valid
       if empty(this.value)
         messagebox("this value cannaot be empty!")
       endif
    Endproc
Enddefine



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
FYI: Our company has two shrink-wrap applications that still execute as a hybrid VFP/Fpd application where some windows are shown using READ, and others are done using READ EVENTS.

I hadn't seen the @..CLASS command before... we don't use it at all. The @..GET command actually puts real TextBox controls on the form, that can be manipulated easily with the form's pageframe1.Page1.SetAll function, after the READ has been executed.

READ EVENTS is the main "wait" position for the program, and the "new" forms are instantiated through CreateObject() (since they're stored in VCX's), but could just as easily be shown through DO FORM ... Any old forms are created through DEFINE WINDOW, @ Say, @ Get, then activated using READ. They coexist with no problems.
 
I knew about the textbox at pageframe1.Page1. But how do you get the 'windows' look in this code:

t_text = "mytext "
@ 2,1 say t_text
@ 2,1 get t_text
read
@ 2,1 say t_text

My solution was to replace the @say command with a mysay-function which places a textboxobject (enabled = .F.) on the form. The next step I made was a myget-function which enabled the textboxobject. But the READ didn't put the cursor in the textbox.
What can you advise me to get a more "windows look" in the example code?
 
SYN

Since this is a hybrid solution, but most of you code is FPD (or FPW) and not VFP, you may want to consider posting these questions in the "Microsoft FoxPro version 1 through 2.6" forum.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I do use a custom function, AtSay, like your proposed MySay, that sets the proper font, and can right-justify a justified font, like Arial.

I call a common routine, ReadIt, that sets up a very specific READ command (and adds OK/Cancel buttons, etc, depending on parameters).

In the READ ACTIVATE clause, I call a custom function to adjust all the TextBox & CheckBox objects to be three dimensional:

(I chopped app-specific stuff out... I hope I didn't break the code)
Code:
FUNCTION riAct( p_Win )
* ReadIt Activate Function 
LOCAL lnI, oCont, aWins, nWins, lnWin, llLck, lnTxtHig
DIMENSION aWins[10]
nWins = Split( @aWins, p_Win, ',' )
lnTxtHig = 0  && v10.00 wgcs
for lnWin = 1 to nWins
  if type(aWins[lnWin])='O'  && If there IS a form object...
    loForm = eval(aWins[lnWin])
    if type('loForm.PageFrame1')='O'
    with loForm.PageFrame1
      llLck = loForm.LockScreen
      .SetAll('FontName',  'Arial',            'TextBox')
      .SetAll('FontSize',  _Screen.FontSize-2, 'TextBox')
      .SetAll('Margin',    0,                  'TextBox')
      .setall('fontbold',  .f.,                'Textbox')

      .SetAll('FontName',  'Arial',            'CheckBox')
      .SetAll('Backcolor', loForm.BackColor,   'Label')
      
      loForm.LockScreen = .T.
      FOR lnI = 1 to .Pages[.PageCount].ControlCount
        oCont = .Pages[.PageCount].Controls[lnI]
        with oCont
          do case  
            case upper(.Class)='COMMANDGROUP'
              * Most common case we care about
              for ctrCtrl2 = 1 to .ButtonCount 
                oCtrl2 = .Buttons[ctrCtrl2]
                  if _Screen.FontSize >= 15  
                    oCtrl2.FontSize = INT( MIN(40,max(5,_Screen.FontSize * 3/4)) )
                  endif
                  oCtrl2.FontName = 'Arial'
                  oCtrl2.FontBold = .F.
              endfor
              oCtrl2 = .null.
            case upper(.Class)='COMMANDBUTTON'
                if _Screen.FontSize >= 15  
                  .FontSize = INT( MIN(72,max(5,_Screen.FontSize * 3/4)) )
                endif
                .FontName = 'Arial'
                .FontBold = .F.
            otherwise
              if type('oCont.BorderStyle')='N' 
                oCont.BorderStyle   = 1
              endif
              if type('oCont.SpecialEffect')='N' 
                oCont.SpecialEffect = 0
                if type('oCont.FontSize')='N' ;
                   and oCont.FontSize = loForm.FontSize ;
                   and oCont.FontSize > 4  
                  oCont.FontSize = oCont.FontSize-1      
                endif
              endif
              if upper(.Class)='TEXTBOX'  
                lnTxtHig = .Height        
              endif
              if upper(.Class)='COMBOBOX' and lnTxtHig>0  
                .Height = lnTxtHig
              endif
              if upper(.Class)='EDITBOX' and not 'DONE'$.Tag  
                .Tag   = .Tag+' DONE'
                .left  = .Left-1
                .Width = .Width+3
              endif
          endcase
        endwith
      ENDFOR
      loForm.LockScreen = llLck
    ENDWITH
    endif
  endif
endfor
RETURN .T.
 
I understand what you're doing in the read function. I'm trying to make the @say to act like a @get (be three dimensional). If the edit mode is activated, and the @get overwrites the @say that the result is just a blinking cursor in that field.

I think that the @say in your read action becomes suddenly three dimensional after switching to the edit mode, isn't it?
 
Oh... You use @ Say's for the data while in view mode, then @ Get when changing to edit mode.

I'd suggest using @ Get's in both conditions, but just make them read only in the View mode (just set the .ReadOnly property .t. in the activate code).

My code for AtSay uses the form object reference (obtained by using the NAME clause in the DEFINE WINDOW command) to AddObject Label controls to the form in the appropriate locations.... I never tried to make these labels look like TextBoxes.
 
wgcs,
thanks for your suggestions!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top