예제 #1
0
void InitControls( HWND hwndDlg )
{
    int   i;
    HWND  hwndLB;

    hwndLB = WinWindowFromID( hwndDlg, CB_OPERATION );
    for( i = 0; i < cOperations; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, dcOperation[ i ].szItem );

    hwndLB = WinWindowFromID( hwndDlg, CB_TYPE );
    for( i = 0; i < cTypes; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, ntsType[ i ].szName );

    hwndLB = WinWindowFromID( hwndDlg, LB_CONTROL );
    for( i = 0; i < cControlTypes; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, dcControl[ i ].szItem );

    hwndLB = WinWindowFromID( hwndDlg, LB_SUPPORTEDOPS );
    for( i = 0; i < cSupportedOps; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, dcSupportedOp[ i ].szItem );

    SetEFTextLimit( hwndDlg, EF_ITEMID, 8 );
    SetEFTextLimit( hwndDlg, CB_TYPE, TYPE_LEN );
    SetEFTextLimit( hwndDlg, EF_CNR_NAME, CCHMAXPATH );
    SetEFTextLimit( hwndDlg, EF_SOURCE_NAME, CCHMAXPATH );
    SetEFTextLimit( hwndDlg, EF_TARGET_NAME, CCHMAXPATH );

    UpdateControls( hwndDlg );
}
예제 #2
0
static void FillFBox(HWND hwnd)
{
    const HWND fbox = WinWindowFromID(hwnd, DID_FFILTER_CB);
    const int nentry = WinDlgLboxSelectedItem(hwnd, DID_ACTION_CB);
    const int nsact = WinDlgLboxSelectedItem(hwnd, DID_SUBACTION_CB);

    const FILEDLG *fdlg = (FILEDLG*)WinQueryWindowPtr(hwnd, QWL_USER);
    const action_t *action = fdlg->fl & FDS_OPEN_DIALOG ? LoadAction : SaveAction;
    const subaction_t *subact = action[nentry].subact;
    const filter_t *filter = subact[nsact].filter;

    int i = 0;

    //
    // fill entries in comboboxes and select starting point
    //
    WinLboxEmpty(fbox);

    while (filter[i].ext) {
        int len = strlen(filter[i].desc) + strlen(filter[i].ext) + 5;
        char *txt = malloc(len);

        sprintf(txt, "<%s> %s", filter[i].desc, filter[i].ext);
        WinInsertLboxItem(fbox, LIT_END, txt);
        lib_free(txt);
        i++;
    }
    WinInsertLboxItem(fbox, LIT_END, "<All Files> ");
    WinSendMsg(fbox, LM_SELECTITEM, 0, (void*)TRUE);
}
예제 #3
0
static void ShowContents(HWND hwnd, char *image_name)
{
    image_contents_t *image;
    image_contents_screencode_t *line;
    image_contents_screencode_t *lines;

    //
    // delete listbox contents
    //
    const HWND hwnd2 = WinWindowFromID(hwnd, DID_CONTENTS_LB);

    LboxFreeContents(hwnd2);

    //
    // don't call the all the vice stuff if file doesn't exist
    //
    if (!util_file_exists(image_name)) {
        return;
    }

    //
    // try to open as a disk or tape image
    //
    image = diskcontents_read(image_name, 0);
    if (!image) {
        return;
    }

    //
    // set the wanted font
    //
    WinSendMsg(hwnd2, LM_SETITEMHEIGHT, (MPARAM)9, 0);

    //
    // convert image contents to screencodes
    //
    lines = image_contents_to_screencode(image);

    //
    // Loop over all entries
    //
    {
        int idx = 0;

        line = lines;
        do {
            WinInsertLboxItem(hwnd2, LIT_END, "");
            WinLboxSetItemHandle(hwnd2, idx, (long)line);
            WinSetLboxItemText(hwnd2, idx, "");
            idx++;
        } while ((line = line->next));
    }

    //
    // free image structure
    //
    image_contents_destroy(image);
}
예제 #4
0
static void FillABox(HWND hwnd, int item)
{
    const HWND abox = WinWindowFromID(hwnd, DID_ACTION_CB);
    const FILEDLG *fdlg = (FILEDLG*)WinQueryWindowPtr(hwnd, QWL_USER);
    const action_t *action = fdlg->fl & FDS_OPEN_DIALOG ? LoadAction : SaveAction;

    int i = 0;
    while (action[i].type) {
        WinInsertLboxItem(abox, LIT_END, action[i++].type);
    }
    WinSendMsg(abox, LM_SELECTITEM, (MPARAM)item, (MPARAM)TRUE);
}
예제 #5
0
static VOID initDlg(HWND hwnd) {
   CHAR buf[1024];
   PSZ pszText, p;
   INT i, j, k;
   for (i = 0; i < 1022; ++i) {
      buf[i] = i % 64 + '!';
      if (i && !(i % 7)) buf[++i] = ' ';
   } /* endfor */
   buf[i] = 0;
   WinSetDlgItemText(hwnd, RI_DTMLE, buf);
   hwnd = WinWindowFromID(hwnd, RI_DTLBOX);
   for (i = 0; i < 64; ++i) {
      sprintf(buf, "listbox item % 4d", i + 1);
      WinInsertLboxItem(hwnd, i, buf);
   } /* endfor */
}
예제 #6
0
USHORT Settings :: GetLanguages (HWND hwnd)
{
    // find all dlls and add the names to the language list
    HDIR          hdir;
    ULONG         c, fl, ul;
    FILEFINDBUF3  findbuf;
    APIRET        rc;
    PSZ           psz;
    HMODULE       hmod;

    fl   = FILE_NORMAL;
    hdir = HDIR_CREATE;
    c    = 1;
    rc   = DosFindFirst ("*.dll", &hdir, fl, &findbuf,
                         sizeof (findbuf), &c, FIL_STANDARD);
    while (!rc)
    {
        // we don't want the extension
        if ((psz = _getext (findbuf.achName)))
            *psz = '\0';
        // try opening the dll and read the version etc. data
        if ((rc = DosLoadModule(PSZ(NULL), 0, findbuf.achName, &hmod)) == NO_ERROR) {
            PVOID pv;
            if (DosGetResource(hmod, RT_RCDATA, DLL_ID, &pv) == NO_ERROR) {
                if (strcmp(PSZ(pv), "Gotcha!") == 0) {
                    psz = PSZ(pv)+strlen(PSZ(pv))+3;
                    ul = WinInsertLboxItem (hwnd, LIT_END, psz);
                    WinSendMsg(hwnd, LM_SETITEMHANDLE, MPFROMLONG(ul),
                               MPFROMP (strdup(findbuf.achName)));
                }
                DosFreeResource(pv);
            }
            DosFreeModule(hmod);
        }
        c = 1;
        rc = DosFindNext (hdir, &findbuf, sizeof (findbuf), &c);
    }
    DosFindClose (hdir);

    return 1;
}
예제 #7
0
static void FillSBox(HWND hwnd, int item)
{
    const HWND sbox = WinWindowFromID(hwnd, DID_SUBACTION_CB);
    const int nentry = WinDlgLboxSelectedItem(hwnd, DID_ACTION_CB);

    const FILEDLG *fdlg = (FILEDLG*)WinQueryWindowPtr(hwnd, QWL_USER);
    const action_t *action = fdlg->fl & FDS_OPEN_DIALOG ? LoadAction : SaveAction;
    const subaction_t *subact = action[nentry].subact;

    int i = 0;

    //
    // fill entries in comboboxes and select starting point
    //
    WinLboxEmpty(sbox);

    while (subact[i].action) {
        WinInsertLboxItem(sbox, LIT_END, subact[i++].action);
    }
    WinSendMsg(sbox, LM_SELECTITEM, (MPARAM)item, (MPARAM)TRUE);

    WinEnableWindow(sbox, action[nentry].enabled);
}
예제 #8
0
MRESULT EXPENTRY
SETTINGS :: Page4Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    static PSETTINGS   pset = NULL;

    switch (msg)
    {
    case WM_INITDLG:
        {
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: start WM_INITDLG" );
#endif
            pset = PSETTINGS (mp2);

            pset->GetLanguages(WinWindowFromID (hwnd, WID_LB_LANGUAGES));

#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: WM_INITDLG: after GetLanguages()" );
#endif
            HDIR          hdir;
            ULONG         c, fl;
            FILEFINDBUF3  findbuf;
            APIRET        rc;
            PSZ           psz;

            // find all hlps and add the names to the language list
            fl   = FILE_NORMAL;
            hdir = HDIR_CREATE;
            c    = 1;
            rc   = DosFindFirst ("*.hlp", &hdir, fl, &findbuf,
                                 sizeof (findbuf), &c, FIL_STANDARD);
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: WM_INITDLG: Entering help file loop ..." );
#endif
            while (!rc)
            {
#ifdef _DOLOGDEBUG_
                LogDebug( "Page4Procedure: WM_INITDLG: Doing '%s' ...", findbuf.achName );
#endif
                if ((psz = _getext (findbuf.achName)))
                    *psz = '\0';
                findbuf.achName[0] = toupper (findbuf.achName[0]);
                WinInsertLboxItem (WinWindowFromID (hwnd, WID_LB_LANGUAGESHELP),
                                   LIT_END, findbuf.achName);
                c = 1;
                rc = DosFindNext (hdir, &findbuf, sizeof (findbuf), &c);
            }
            DosFindClose (hdir);
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: WM_INITDLG: help file loop done." );
#endif

            WinSendMsg (hwnd, UM_SETTINGS2DIALOG, 0,0);

            if (pset->fAutoLanguage)
                WinEnableWindow (WinWindowFromID (hwnd, WID_ST_LANGNOTE),
                                 FALSE);
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: end WM_INITDLG" );
#endif
        }
        return MRESULT (FALSE);

    case WM_COMMAND:
        if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
            WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
        return MRESULT( FALSE );

    case UM_SETTINGS2DIALOG:
        {

#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: start UM_SETTINGS2DIALOG" );
#endif
            // select the appropriate entry in the language-listbox
            CHAR     ach[_MAX_FNAME];
            HWND     hwndLB = WinWindowFromID (hwnd, WID_LB_LANGUAGES);
            ULONG    c, i;

            c = WinQueryLboxCount (hwndLB);

            for (i = 0; i < c; i++)
            {
#ifdef _DOLOGDEBUG_
                LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: i.1 = %d", i );
#endif
                PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
                                                 LM_QUERYITEMHANDLE,
                                                 MPFROMLONG(i), NULL));
//                WinQueryLboxItemText (hwndLB, i, ach, sizeof (ach));
                if (stricmp (pset->QueryString(SEI_LANGUAGE), psz) == 0)
                    break;
            }
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: after loop 1" );
#endif
            if (i < c)
                WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
                                   MPFROMSHORT (i), MPFROMSHORT (TRUE));
            else
                WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
                                   MPFROMSHORT (0), MPFROMSHORT (TRUE));
            hwndLB = WinWindowFromID (hwnd, WID_LB_LANGUAGESHELP);
            c = WinQueryLboxCount (hwndLB);

            for (i = 0; i < c; i++)
            {
#ifdef _DOLOGDEBUG_
                LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: i.2 = %d", i );
#endif
                WinQueryLboxItemText (hwndLB, i, ach, sizeof (ach));
                if (stricmp (pset->QueryString (SEI_LANGUAGEHELP), ach) == 0)
                    break;
            }
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: after loop 2" );
#endif
            if (i < c)
                WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP, LM_SELECTITEM,
                                   MPFROMSHORT (i), MPFROMSHORT (TRUE));
            else
                WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP, LM_SELECTITEM,
                                   MPFROMSHORT (0), MPFROMSHORT (TRUE));
#ifdef _DOLOGDEBUG_
            LogDebug( "Page4Procedure: end UM_SETTINGS2DIALOG" );
#endif
        }
        return MRESULT (FALSE);

    case WM_DESTROY:
        {
            CHAR   ach[_MAX_FNAME];

            ULONG ul = USHORT (WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
                                                  LM_QUERYSELECTION,
                                                  MPFROMLONG (LIT_FIRST), 0L));
            PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
                                             LM_QUERYITEMHANDLE,
                                             MPFROMLONG(ul), NULL));
            pset->SetString(SEI_LANGUAGE, psz);

            ul = USHORT (WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP,
                                            LM_QUERYSELECTION,
                                            MPFROMLONG (LIT_FIRST), 0L));
            WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP, LM_QUERYITEMTEXT,
                               MPFROM2SHORT (ul, sizeof (ach)), MPFROMP (ach));
            pset->SetString (SEI_LANGUAGEHELP, ach);
        }
        return MRESULT (FALSE);
    }

    return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
예제 #9
0
MRESULT EXPENTRY
SETTINGS :: Page1Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    static PSETTINGS   pset = NULL;

    switch (msg)
    {
    case WM_INITDLG: {
#ifdef _DOLOGDEBUG_
        LogDebug( "Page1Procedure: start WM_INITDLG" );
#endif
        ULONG ul;
        pset = PSETTINGS (mp2);
        for( int i = 0; i < BMF_INVALID; i++ ) {
            if( pset->ifi[ i ].available ) {
                ul = WinInsertLboxItem( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
                                        LIT_END, pset->ifi[ i ].label );
                WinSendMsg( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
                            LM_SETITEMHANDLE, MPFROMLONG(ul), MPFROMP( i ) );
            }
        }
#ifdef _DOLOGDEBUG_
        LogDebug( "Page1Procedure: end WM_INITDLG" );
#endif
        return MRESULT (FALSE);
    }

    case WM_COMMAND:
        if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
            WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
        return MRESULT( FALSE );

    case UM_SETTINGS2DIALOG: {
#ifdef _DOLOGDEBUG_
        LogDebug( "Page1Procedure: start UM_SETTINGS2DIALOG" );
#endif
        // set num save dir name
        WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETTEXTLIMIT,
                           MPARAM (_MAX_PATH-1), (MPARAM)0);
        WinSetDlgItemText (hwnd, WID_E_NUMSAVEDIR,
                           pset->QueryNumSaveDir ());
        WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETSEL,
                           MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);

        // set force file name
        WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETTEXTLIMIT,
                           MPARAM (_MAX_PATH-1), (MPARAM)0);
        WinSetDlgItemText (hwnd, WID_E_FORCESAVEFILE,
                           pset->QueryForceSaveFile ());
        WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETSEL,
                           MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);

/*        switch (pset->QueryFileFormat ())
        {
        case BMF_20:
            WinSendDlgItemMsg (hwnd, WID_RB_BMF20, BM_CLICK,
                               MPFROMSHORT(TRUE), 0);
            break;
        case BMF_12:
            WinSendDlgItemMsg (hwnd, WID_RB_BMF12, BM_CLICK,
                               MPFROMSHORT(TRUE), 0);
            break;
        default:
            WinSendDlgItemMsg (hwnd, WID_RB_BMF16, BM_CLICK,
                               MPFROMSHORT(TRUE), 0);
            break;
        } */

        // Select the appropriate entry in the fileformat-listbox.
        HWND     hwndLB = WinWindowFromID( hwnd, WID_LB_FILEFORMAT );
        ULONG    c, i;

        c = WinQueryLboxCount( hwndLB );
        for( i = 0; i < c; i++ )
        {
            ULONG type = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
                                                   LM_QUERYITEMHANDLE,
                                                   MPFROMLONG(i), NULL ) );
            if( type == ULONG( pset->QueryFileFormat() ) )
                break;
        }
        if( i < c )
            WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
                               MPFROMSHORT(i), MPFROMSHORT(TRUE) );
        else
            WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
                               MPFROMSHORT(0), MPFROMSHORT(TRUE) );

        // Select appropriate radiobutton for save style.
        switch (pset->QueryFileSaveStyle ())
        {
        case FSS_NUMFILES:
            WinSendDlgItemMsg (hwnd, WID_RB_FSSNUMFILES, BM_CLICK,
                               MPFROMSHORT(TRUE), 0);
            AdjustSaveTypeButtons (FALSE);
            break;

        case FSS_FORCEFILE:
            WinSendDlgItemMsg (hwnd, WID_RB_FSSFORCEFILE, BM_CLICK,
                               MPFROMSHORT(TRUE), 0);
            AdjustSaveTypeButtons (TRUE);
            break;

        default:
            WinSendDlgItemMsg (hwnd, WID_RB_FSSPROMPT, BM_CLICK,
                               MPFROMSHORT(TRUE), 0);
            AdjustSaveTypeButtons (FALSE);
            break;
        }
#ifdef _DOLOGDEBUG_
        LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
#endif
        return MRESULT (FALSE);
    }

    case UM_ADJUST:
        {
#ifdef _DOLOGDEBUG_
            LogDebug( "Page1Procedure: start UM_ADJUST" );
#endif
            // get file save style
            if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSNUMFILES),
                            BM_QUERYCHECK, 0,0))
                pset->SetFileSaveStyle (FSS_NUMFILES);
            else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSFORCEFILE),
                                 BM_QUERYCHECK, 0,0))
                pset->SetFileSaveStyle (FSS_FORCEFILE);
            else
                pset->SetFileSaveStyle (FSS_PROMPT);
#ifdef _DOLOGDEBUG_
            LogDebug( "Page1Procedure: checkpoint 1" );
#endif

            // Get file format.
            ULONG ul = USHORT( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
                                                  LM_QUERYSELECTION,
                                                  MPFROMLONG( LIT_FIRST ),
                                                  0L ) );
            ul = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
                                           LM_QUERYITEMHANDLE,
                                           MPFROMLONG( ul ), NULL ) );
            pset->SetFileFormat( SHORT( ul ) );
/*            if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_BMF12),
                            BM_QUERYCHECK, 0,0))
                pset->SetFileFormat (BMF_12);
            else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_BMF20),
                                 BM_QUERYCHECK, 0,0))
                pset->SetFileFormat (BMF_20);
            else
                pset->SetFileFormat (BMF_16); */
#ifdef _DOLOGDEBUG_
            LogDebug( "Page1Procedure: checkpoint 2" );
#endif

            // num save dir file name
            CHAR   psz[_MAX_PATH];
            WinQueryDlgItemText (hwnd, WID_E_NUMSAVEDIR, _MAX_PATH, psz);
            pset->SetNumSaveDir (psz);

            // force file name
            WinQueryDlgItemText (hwnd, WID_E_FORCESAVEFILE, _MAX_PATH, psz);
            pset->SetForceSaveFile (psz);

            AdjustSaveTypeButtons
                (BOOL (pset->QueryFileSaveStyle () == FSS_FORCEFILE));
#ifdef _DOLOGDEBUG_
            LogDebug( "Page1Procedure: end UM_ADJUST" );
#endif
        }
        break;

    case WM_CONTROL:
        switch (SHORT1FROMMP (mp1))
        {
        case WID_RB_FSSFORCEFILE:
            AdjustSaveTypeButtons (TRUE);
            break;

        case WID_RB_FSSPROMPT:
        case WID_RB_FSSNUMFILES:
            AdjustSaveTypeButtons (FALSE);
            break;
        }
        return MRESULT (FALSE);
    }

    return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
예제 #10
0
MRESULT CreInstDlg::wmCommand(HM12){
USE_HM12;
USHORT command;
char typename[MAXNAMELENGTH]="";
char propname[MAXNAMELENGTH]="";
char newvalue[MAXNAMELENGTH]="";
int index,dbtype,oktype,i;
ODB_INT intval;
ODB_REAL realval;
ODB_SET coll;
object *obj,*o;
command=SHORT1FROMMP( mp1 ) ;
	switch(command)
	{
	case DID_OK:  //ok button pressed. Create object
		index=WinQueryLboxSelectedItem(hwndlbtypes);
		WinQueryLboxItemText(hwndlbtypes,index,typename,MAXNAMELENGTH);
		if (strlen(typename)<1) {
			//type not specified
			WinMessageBox(HWND_DESKTOP,hwndOwner,(PCH) "A type must be spec.",
			(PCH)"Alert",0,MB_NOICON|MB_OK);
			break;
			}
		else {
			obj=odb.create_instance(typename);
			if (obj==NULL) {
				//object could not be created, possibly because
				//extentless type selectd
				WinMessageBox(HWND_DESKTOP,hwndOwner,(PCH) "Could not create object",
				(PCH)"Alert",0,MB_NOICON|MB_OK);
				break;
			};
			i=WinQueryLboxCount(hwndassignedprop);
			i--;
			while(i>=0){
				//check that the data for each prop is ok
				//and set the properies for the object
				WinQueryLboxItemText(hwndassignedprop,i,propname,MAXNAMELENGTH);
				WinQueryLboxItemText(hwndassignedprop,i,propname,MAXNAMELENGTH);
				WinQueryLboxItemText(hwndpropval,i,newvalue,MAXNAMELENGTH);
				dbtype=odb.getpropertytype(typename,propname);

				if (dbtype==_INT_) {
					validate_integer(newvalue,intval);
					(*obj).setproperty_value(propname,intval);
					};
				if (dbtype==_OTHER_) {
					validate_integer(newvalue,intval);
					o=odb.getobjectwithoid("Usertypes",intval);
					(*obj).setproperty_value(propname,o);
					};
				if (dbtype==_REAL_) {
					validate_real(newvalue,realval);
					(*obj).setproperty_value(propname,realval);
					};
				if (dbtype==_COLLECTION_){
					coll=new collection(_OTHER_);
					if (validate_set(newvalue,&odb,coll)<0) (*coll).~collection();
					(*obj).setproperty_value(propname,coll);
					};
				if (dbtype==_INT_COLLECTION_){
					coll=new collection(_INT_);
					if (validate_set(newvalue,&odb,coll)<0) (*coll).~collection();
					(*obj).setproperty_value(propname,coll);
					};
				if (dbtype==_REAL_COLLECTION_){
					coll=new collection(_REAL_);
					if (validate_set(newvalue,&odb,coll)<0) (*coll).~collection();
					(*obj).setproperty_value(propname,coll);
					};
				if (dbtype==_CHAR_COLLECTION_){
					coll=new collection(_CHAR_);
					if (validate_set(newvalue,&odb,coll)<0) (*coll).~collection();
					(*obj).setproperty_value(propname,coll);
					};
				if (dbtype==_CHAR_) (*obj).setproperty_value(propname,newvalue);
				i--;
				}; //end while all properties set.
				//deleta all unassigned praps
			(*this).clearlbox(hwndassignedprop);
			clearlbox(hwndpropval);
			clearlbox(hwndlbprops);
			WinSetWindowText(hwndviewval,(PSZ)"");
			populate_props(hwndlbprops,typename,  odb);
			noassignedprops=0; //no assigned properties anymore
			WinMessageBox(HWND_DESKTOP,hwndOwner,(PCH) "Instance created.",
			(PCH)"Success",0,MB_NOICON|MB_OK);
		}; //else		//create the object and set properties
		return (MRESULT) FALSE;
		//break;
	case DID_CANCEL:  //quit this window
	  if(WinMessageBox(HWND_DESKTOP,hwndOwner,(PCH) "Quit this window?",
			(PCH)"Sanity Check",0,
			MB_NOICON|MB_OKCANCEL)==MBID_OK)
		WinDismissDlg( hwnd, TRUE );  // Removes the dialog box
	  return (MRESULT) FALSE;
	case PB_SET:
		//assign property a value. The prop is moved to assignedprops
		//and value is validated and moved to hidden listbox
		index=WinQueryLboxSelectedItem(hwndlbtypes); //typename
		WinQueryLboxItemText(hwndlbtypes,index,typename,MAXNAMELENGTH);
		index=WinQueryLboxSelectedItem(hwndlbprops); //propname
		WinQueryLboxItemText(hwndlbprops,index,propname,MAXNAMELENGTH);
		WinQueryWindowText(hwndnewvalue,MAXNAMELENGTH,newvalue);
		dbtype=odb.getpropertytype(typename,propname);
		if (dbtype==_INT_)
			oktype=validate_integer(newvalue,intval);
		if (dbtype==_OTHER_){
			oktype=validate_integer(newvalue,intval);
			if (oktype!=0) {
				//check that there is an object with the oid
				obj=odb.getobjectwithoid("Usertypes",intval);
				if (obj==NULL) oktype=0;
				}
			};
		if (dbtype==_REAL_)
			oktype=validate_real(newvalue,realval);
		if (dbtype==_CHAR_) oktype=1;
		if ((strlen(newvalue)>0)&&(strlen(propname)>0)&&(oktype!=0)){
			//move assigned prop from prop cmb box to assigned props
			WinInsertLboxItem(hwndassignedprop,noassignedprops,(PSZ)propname);
			WinInsertLboxItem(hwndpropval,noassignedprops,(PSZ)newvalue);
			noassignedprops++;
			WinDeleteLboxItem(hwndlbprops,index);
			WinSetWindowText(hwnddatatype,(PSZ)"");
			WinSetWindowText(hwndnewvalue,(PSZ)"");
			}
		else
		WinMessageBox(HWND_DESKTOP,hwndOwner,(PCH) "Missing or erroneous data",
			(PCH)"Alert",0,MB_OKCANCEL);
		break;
	default:
	  return  WinDefDlgProc( hwnd, msg, mp1, mp2 );
      }