Page 1 of 1
OBJ parameter
Posted: Tue May 21, 2013 12:17 am
by Pablo César
Dear gentlemen,
I have found this interesting code which is for OOHG:
Code: Select all
/*
* ComboBox Sample n° 7
* Author: Fernando Yurisich <fernando.yurisich@gmail.com>
* Licensed under The Code Project Open License (CPOL) 1.02
* See <http://www.codeproject.com/info/cpol10.aspx>
*
* Based on a sample from OOHG distribution
* (c) 2002 Roberto Lopez
* Modified by Ciro Vargas Clemow <cvc@oohg.org>
*/
#include "oohg.ch"
FUNCTION Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'CaretPos in ComboBox with DisplaEdit Clause' ;
MAIN
DEFINE MAIN MENU
DEFINE POPUP 'Test'
MENUITEM 'Get Value' ;
ACTION autoMsgInfo( oCombo:Value )
MENUITEM 'Set Value' ;
ACTION oCombo:Value := 1
MENUITEM 'Get DisplayValue' ;
ACTION MsgInfo( oCombo:DisplayValue )
MENUITEM 'Set DisplayValue' ;
ACTION ( oCombo:DisplayValue := 'New Text', ;
oCombo:SetFocus(), ;
oCombo:CaretPos := 3 )
END POPUP
END MENU
@ 10,10 COMBOBOX Combo_1 OBJ oCombo ;
ITEMS { 'Orange' , 'Black' , 'Yellow' } ;
VALUE 1 ;
DISPLAYEDIT ;
IMAGE {} ;
ON DISPLAYCHANGE ForceUpperCase( oCombo, oText )
oCombo:FontColorSelected := GREEN
oCombo:BackColorSelected := YELLOW
@ 50, 10 TEXTBOX Text_1 OBJ oText
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
RETURN NIL
STATIC FUNCTION ForceUpperCase( oCombo, oText )
LOCAL nPos := oCombo:CaretPos
oText:value := oCombo:DisplayValue
oCombo:DisplayValue := Upper( oCombo:DisplayValue )
oCombo:CaretPos := nPos
RETURN NIL
Please note there is a new directive for declaring all components: OBJ which assigned a name o one OBJECT.
My question is:
Is It possible to get this in HMG ?
This would give use more power for assignements on our code ?
Re: OBJ parameter
Posted: Tue May 21, 2013 5:18 am
by mol
HMG 3.xx is not based on objects.
So can not use suc a code:
Code: Select all
oCombo:FontColorSelected := GREEN
oCombo:BackColorSelected := YELLOW
It's possible in HMG 4.x, but this release is suspended.
OBJ parameter
Posted: Tue May 21, 2013 7:45 am
by Pablo César
Thank you Marek for replying.
I thought it could be a good idea to work at leat as semi-OOP. But as you said, HMG4 it was already. Which is a very sad to have been discontinued the work of HMG4...
We ended up losing a lot without it... so sad !

Re: OBJ parameter
Posted: Tue May 21, 2013 7:57 am
by mol
Pablo César wrote: Which is a very sad to have been discontinued the work of HMG4...
We ended up losing a lot without it... so sad !

I agree with you...
OBJ parameter
Posted: Tue May 21, 2013 8:06 am
by Pablo César
Probably one of the reasons they have discouraged the development of HMG4 may have been the lack of an IDE.
I was enjoying seeing the HMG4 being adapted to work in semi-OOP...
Re: OBJ parameter
Posted: Tue May 21, 2013 10:29 am
by danielmaximiliano
Hola Pablo :
Yo en T.Pascal utilizaba "objetos", la forma más basica era esta.
Code: Select all
type
alumnos = RECORD
clave:integer;
nombre:string[30];
estatura:real;
end;
var
alumno:alumnos;
BEGIN
clrscr;
(* capturando registro *)
write('dame clave : ');readln(alumno.clave);
write('dame nombre : ');readln(alumno.nombre);
write('dame estatura : ');readln(alumno.estatura);
(* operaciones *)
alumno.estatura := alumno.estatura + 0.23456;
(* despliegue *)
writeln;writeln;
writeln('clave : ',alumno.clave);
writeln('nombre : ',alumno.nombre);
writeln('estatura : ',alumno.estatura:0:2);
readln;
END.
ya estoy adaptando mi codigo para trabajar de esa manera
Code: Select all
alumno:nombre := 'Pablo'
alumno:grabar
ud puede adaptar y trabajar con OBJETOS tanto HMG y su codigo :
míre usted hmg.ch y textbox.prg dentro de hmg.4, haga una pequeña modificacion a los sources de hmg.3 y haga una prueba si funciona.
parcial codigo de textbox.prg
Code: Select all
#include "hmg.ch"
/*==============================================================================
TEXTBOX class
==============================================================================*/
CLASS TEXTBOX FROM CONTROL
DATA cClass INIT "TEXTBOX"
// data: please preserve alphabetic order.
DATA nAlignment INIT TXT_LEFT PROTECTED
DATA nCaseConvert INIT TXT_NONE PROTECTED
DATA oColor INIT NIL PROTECTED
DATA nDataType INIT NIL PROTECTED
DATA cDecPoint INIT "." PROTECTED // by default USA format
DATA cFormat INIT "" PROTECTED // by default USA format ELSE European
DATA lLostFocusExecFlag INIT .F. PROTECTED
DATA cThousands INIT "," PROTECTED // by default USA format
DATA nMaxLength INIT NIL PROTECTED
DATA cInputMask INIT "" PROTECTED // what user set
DATA xItemDisplay INIT NIL PROTECTED
DATA xItemEdit INIT NIL PROTECTED
DATA bOnValid INIT NIL PROTECTED
DATA cPictDateFormat INIT "" PROTECTED
DATA cPictDisplay INIT "" PROTECTED
DATA cPictEdit INIT "" PROTECTED
DATA oRegExp INIT NIL PROTECTED
DATA cRegExpValidator INIT NIL PROTECTED
DATA oRegExpValidator INIT NIL PROTECTED
DATA xValue INIT NIL PROTECTED
parcial codigo para hmg.ch
Code: Select all
#command @ <nRow>, <nCol> TEXTBOX <tagreference> ;
[ <dummy1: OF, PARENT> <oParent> ] ;
[ TOVAR <varname> ] ;
[ HEIGHT <nHeight> ] ;
[ WIDTH <nWidth> ] ;
[ FIELD <cField> ] ;
[ VALUE <cValue> ] ;
[ < lReadOnly: READONLY > ] ;
[ FONT <cFontName> ] ;
[ SIZE <nFontSize> ] ;
[ <lFontBold : BOLD> ] ;
[ <lFontItalic : ITALIC> ] ;
[ <lFontUnderline : UNDERLINE> ] ;
[ <lFontStrikeout : STRIKEOUT> ] ;
[ TOOLTIP <cToolTip> ] ;
[ BACKCOLOR <aBackColor> ] ;
[ FONTCOLOR <aFontColor> ] ;
[ DISABLEDBACKCOLOR <aDisabledBackColor> ] ;
[ DISABLEDFONTCOLOR <aDisabledFontColor> ] ;
[ MAXLENGTH <nMaxLength> ] ;
[ <lUpper: UPPERCASE> ] ;
[ <lLower: LOWERCASE> ] ;
[ <lNumeric: NUMERIC> ] ;
[ <lDate: DATE> ] ;
[ <lPassWord: PASSWORD> ] ;
[ INPUTMASK <cInputMask> ] ;
[ FORMAT <cFormat> ] ;
[ ON CHANGE <bOnChange> ] ;
[ ON GOTFOCUS <bOnGotFocus> ] ;
[ ON LOSTFOCUS <bOnLostFocus> ] ;
[ ON ENTER <bOnEnter> ] ;
[ <lRightAlign: RIGHTALIGN> ] ;
[ <lNoVisible: INVISIBLE> ] ;
[ <lNoTabStop: NOTABSTOP> ] ;
[ HELPID <nHelpId> ] ;
=>;
With Object [<varname> :=] TEXTBOX():New(<"tagreference"> [ , <oParent> ]) ;;
[:Row := <nRow> ] ;;
[:Col := <nCol> ] ;;
[:Width := <nWidth> ] ;;
[:Height := <nHeight> ] ;;
[:Field := <"cField"> ] ;;
[:Value := <cValue> ] ;;
[:lReadOnly := <.lReadOnly.> ] ;;
[:FontName := <cFontName> ] ;;
[:FontSize := <nFontSize> ] ;;
[:FontBold := <.lFontBold.> ] ;;
[:FontItalic := <.lFontItalic.> ] ;;
[:FontUnderline := <.lFontUnderline.> ] ;;
[:FontStrikeout := <.lFontStrikeout.> ] ;;
[:ToolTip := <cToolTip> ] ;;
[:BackColor := <aBackColor> ] ;;
[:FontColor := <aFontColor> ] ;;
[:MaxLength := <nMaxLength> ] ;;
[:PassWord := <.lPassWord.> ] ;;
[:InputMask := <cInputMask> ] ;;
[:Format := <cFormat> ] ;;
[:OnChange := <{bOnChange}> ] ;;
[:OnGotFocus := <{bOnGotFocus}> ] ;;
[:OnLostFocus := <{bOnLostFocus}> ] ;;
[:OnEnter := <{bOnEnter}> ] ;;
[:Visible := !<.lNoVisible.> ] ;;
[:TabStop := !<.lNoTabStop.> ] ;;
[:HelpId := <nHelpId> ] ;;
[:Alignment := if( <.lRightAlign.> , 2 , 0 ) ] ;;
[:DisabledBackColor := <aDisabledBackColor> ] ;;
[:DisabledFontColor := <aDisabledFontColor> ] ;;
[:CaseConvert := if ( <.lUpper.> , 1 , If( <.lLower.> , 2 , 0 ) ) ] ;;
[:DataType := if ( <.lNumeric.> , 1 , if( <.lDate.> , 2 ,0 )) ] ;;
End With
OBJ parameter
Posted: Tue May 21, 2013 2:39 pm
by Pablo César
Gracias Daniel por responder.
Lo que quieres decirnos es que es posible implementar objetos modificando el código fuente de HMG 3 ? Confirma eso ? Porque yo no hé hecho cambios de esta naturaleza. En ese punto, busco ser conservador, pero seria interesante tu confirmación. Porque con modificaciones poderíamos evaluar la posibilidad de dejar HMG3 en SEMI-OOP y dejarlo como opcional con la clausula "OBJ" (asi como lo hace en OOHG). Eso claro si es aprobado por Roberto Lopez, asi tendríamos mas poder de acceso a objetos.
-- Transalated to English
What you tell us is that objects can be implemented by modifying the source code of HMG 3? Please, could you confirm it ? Because I not use to male this source modifications. At that point, I try to be conservative, but it would be interesting to your confirmation. For with changes we could evaluate the possibility of let HMG3 ready to work with SEMI-OOP and with optional clause "OBJ" (as well as it does in ooHG). Of course under Roberto approval, so we would have more access to objects.