Non showing DIALOG resource

Post Reply
kronos911
Posts: 37
Joined: Sat Oct 22, 2005 2:15 pm
Location: Greece

Non showing DIALOG resource

Post by kronos911 »

I’m tiring to load a DIALOG from a RC script (inside the EXE) and or a DLL file. The problem is that nothing happens, the DIALOG doesn’t show up at all. It’s like the code is not there..
I designed the DIALOG in WorkShop 4.5. I used Microsoft’s RC.EXE v3.1 to link the RC file into the EXE. For the DLL I had to open and save a copy of screens.dll (from FW\DLL) with Symantec’s Resource Editor (from the FW site) and then work with it in WorkShop (unsupported file format when saving the original DLL). I also added icons and bitmaps which load fine from both files. The only problem is the DIALOG resource. All test PRG from the samples directory that use DLL DIALOGS when I link them work fine event he RC ones.
Here is what I have

RC Script from DLL

Code: Select all

FORM_2 DIALOG 10, 18, 210, 123
STYLE DS_MODALFRAME | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 10, "Arial"
{
 LTEXT "Υπάλληλος", 101, 6, 9, 38, 8, NOT WS_GROUP
 COMBOBOX 201, 50, 7, 83, 40, CBS_DROPDOWNLIST
 EDITTEXT 210, 50, 7, 77, 11, ES_READONLY | WS_DISABLED | WS_BORDER | WS_TABSTOP
 LTEXT "Ημερομηνία", 102, 6, 22, 40, 8, NOT WS_GROUP
 EDITTEXT 202, 50, 21, 45, 10, ES_AUTOHSCROLL | NOT WS_TABSTOP | WS_BORDER
 GROUPBOX "Θέση Φακέλου", 103, 6, 36, 199, 22, BS_GROUPBOX
 RADIOBUTTON "για έλεγχο", 203, 11, 46, 42, 10, BS_AUTORADIOBUTTON | WS_GROUP
 RADIOBUTTON "στο ντουλάπι", 204, 80, 46, 50, 10, BS_AUTORADIOBUTTON
 RADIOBUTTON "άγνωστη", 205, 150, 46, 39, 10, BS_AUTORADIOBUTTON
 LTEXT "Δεκτό", 104, 6, 65, 29, 8, NOT WS_GROUP
 PUSHBUTTON "Οχι", 206, 52, 64, 28, 10, NOT WS_TABSTOP
 LTEXT "Παρατηρήσεις", 105, 6, 77, 49, 11, NOT WS_GROUP
 EDITTEXT 207, 6, 88, 199, 28, ES_MULTILINE | ES_AUTOHSCROLL | NOT WS_TABSTOP | WS_BORDER
 PUSHBUTTON "Εντάξει", 208, 153, 7, 50, 11, NOT WS_TABSTOP
 PUSHBUTTON "\xA2κυρο", 209, 153, 21, 50, 12, NOT WS_TABSTOP
}
PRG file

Code: Select all

STATIC PROCEDURE UpDateF2(cTitle, nNumber)
  LOCAL oF2_Dlg, aF2Ctrls := ARRAY(8), aHreosiLst, lShow := .f., nRDMnu

  SELECT IFTHRE
  SET ORDER TO nNumber
  DBGOTOP()
  aHreosiLst := {}
  DO WHILE !EOF()
    AADD(aHreosiLst, OemToAnsi(IFTHRE->NAME))
    DBSKIP(1)
  ENDDO
  SELECT FOLDER

  DEFINE DIALOG oF2_Dlg NAME "FORM_2" FONT oMainFont TITLE cTitle

    IF lShow
      REDEFINE GET aF2Ctrls[2] VAR aForms2[nNumber, IFT_HREOSI] ID 210 OF oF2_Dlg READONLY
    ELSE
      REDEFINE COMBOBOX aF2Ctrls[1] VAR aForms2[nNumber, IFT_HREOSI] ITEMS aHreosiLst ID 201 OF oF2_Dlg
      aF2Ctrls[1]:nAT := (ASCAN(aHreosiLst, aForms2[nNumber, IFT_HREOSI]))
    ENDIF
    REDEFINE GET aF2Ctrls[3] VAR aForms2[nNumber, IFT_LDATE] ID 202 OF oF2_Dlg
  
    nRDMnu := IIF(aForms2[nNumber, IFT_UNKNOWN], 1, IIF(aForms2[nNumber, IFT_CLASET],2,3))
    REDEFINE RADIO aF2Ctrls[4] VAR nRDMnu ID 203, 204, 205 OF oF2_Dlg
  
    REDEFINE BUTTON aF2Ctrls[5] ID 206 ACTION (aForms2[nNumber, IFT_STATUS] := !aForms2[nNumber, IFT_STATUS], aF2Ctrls[7]:SetText(OemToAnsi(IIF(aForms2[nNumber, IFT_STATUS],"Œ˜ ", "Ž® ")))) OF oF2_Dlg

//    REDEFINE GET aF2Ctrls[6] VAR aForms2[nNumber, IFT_NOTES] MEMO ID 207 OF oF2_Dlg ON CHANGE MemoLenChk(120, nKey, nFlags, Self)

    REDEFINE BUTTON aF2Ctrls[7] ID 208 ACTION (oF2_Dlg:End()) OF oF2_Dlg
    REDEFINE BUTTON aF2Ctrls[8] ID 209 ACTION (oF2_Dlg:End()) OF oF2_Dlg

  ACTIVATE DIALOG oF2_Dlg CENTER ON INIT (aF2Ctrls[6] := TMultiGet():ReDefine( 207, { | u | If( PCount()==0, aForms2[nNumber, 8], aForms2[nNumber, 8]:= u ) }, oF2_Dlg,,,,,,, .F.,, .F.,,{|nKey, nFlags, Self| MemoLenChk(80, nKey, nFlags, Self)} ))

  DO CASE
  CASE nRDMnu = 1
    aForms2[nNumber, IFT_UNKNOWN] := .T.
    aForms2[nNumber, IFT_CLASET]  := .F.
    aForms2[nNumber, IFT_CHKING]  := .F.
  CASE nRDMnu = 2
    aForms2[nNumber, IFT_UNKNOWN] := .F.
    aForms2[nNumber, IFT_CLASET]  := .T.
    aForms2[nNumber, IFT_CHKING]  := .F.
  CASE nRDMnu = 3
    aForms2[nNumber, IFT_UNKNOWN] := .F.
    aForms2[nNumber, IFT_CLASET]  := .F.
    aForms2[nNumber, IFT_CHKING]  := .T.
  ENDCASE

RETURN

PPO

Code: Select all

STATIC PROCEDURE UpDateF2(cTitle, nNumber)
  LOCAL oF2_Dlg, aF2Ctrls := ARRAY(8), aHreosiLst, lShow := .F., nRDMnu

  dbSelectArea( "IFTHRE" )
  ordSetFocus( nNumber )
  DBGOTOP()
  aHreosiLst := {}
  while !EOF()
    AADD(aHreosiLst, OemToAnsi(IFTHRE->NAME))
    DBSKIP(1)
  ENDDO
  dbSelectArea( "FOLDER" )

  oF2_Dlg = TDialog():New(,,,, cTitle, "FORM_2",, .F.,,,,,, .F.,, oMainFont,,, )

    IF lShow
      aF2Ctrls[2] := TGet():ReDefine( 210, { | u | If( PCount()==0, aForms2[nNumber, 2], aForms2[nNumber, 2]:= u ) }, oF2_Dlg,,,,,,,,, .F.,,, .T., .F.,,,,)
    ELSE
      aF2Ctrls[1] := TComboBox():ReDefine( 201, { | u | If( PCount()==0, aForms2[nNumber, 2], aForms2[nNumber, 2]:= u ) }, aHreosiLst, oF2_Dlg,,,,,,, .F.,,,,,, )
      aF2Ctrls[1]:nAT := (ASCAN(aHreosiLst, aForms2[nNumber, 2]))
    ENDIF
    aF2Ctrls[3] := TGet():ReDefine( 202, { | u | If( PCount()==0, aForms2[nNumber, 3], aForms2[nNumber, 3]:= u ) }, oF2_Dlg,,,,,,,,, .F.,,, .F., .F.,,,,)

    nRDMnu := IIF(aForms2[nNumber, 6], 1, IIF(aForms2[nNumber, 5],2,3))
    aF2Ctrls[4] := TRadMenu():Redefine( { | u | If( PCount()==0, nRDMnu, nRDMnu:= u ) }, oF2_Dlg,, { 203, 204, 205 },,,,, .F.,, )

    aF2Ctrls[5] := OF := oF2_Dlg := TButton():ReDefine( 206,{||(aForms2[nNumber, 7] := !aForms2[nNumber, 7], aF2Ctrls[7]:SetText(OemToAnsi(IIF(aForms2[nNumber, 7],"Œ˜ ", "Ž® "))))},,,, .F.,,,, .F. )



    aF2Ctrls[7] := OF := oF2_Dlg := TButton():ReDefine( 208,{||(oF2_Dlg:End())},,,, .F.,,,, .F. )
    aF2Ctrls[8] := OF := oF2_Dlg := TButton():ReDefine( 209,{||(oF2_Dlg:End())},,,, .F.,,,, .F. )

  oF2_Dlg:Activate( oF2_Dlg:bLClicked, oF2_Dlg:bMoved, oF2_Dlg:bPainted, .T.,,,{|Self|(aF2Ctrls[6] := TMultiGet():ReDefine( 207, { | u | If( PCount()==0, aForms2[nNumber, 8], aForms2[nNumber, 8]:= u ) }, oF2_Dlg,,,,,,, .F.,, .F.,,{|nKey, nFlags, Self| MemoLenChk(80, nKey, nFlags, Self)} ))}, oF2_Dlg:bRClicked, )

  DO CASE
  CASE nRDMnu = 1
    aForms2[nNumber, 6] := .T.
    aForms2[nNumber, 5]  := .F.
    aForms2[nNumber, 4]  := .F.
  CASE nRDMnu = 2
    aForms2[nNumber, 6] := .F.
    aForms2[nNumber, 5]  := .T.
    aForms2[nNumber, 4]  := .F.
  CASE nRDMnu = 3
    aForms2[nNumber, 6] := .F.
    aForms2[nNumber, 5]  := .F.
    aForms2[nNumber, 4]  := .T.
  ENDCASE

RETURN

When using the DLL I add SET RESOURCES TO “WIFTSRN.DLL” in the main PRG file.
Any ideas what is going wrong.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Please review the DLL with the Resources Workshop to check if the dialogbox is properly placed into it.

Also, try changing the name of the dialogbox from FORM_2 into test. Some names may get refused by Windows.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dbSoft
Posts: 16
Joined: Thu Oct 13, 2005 8:31 pm
Location: Greece
Contact:

Post by dbSoft »

Αφαίρεσε ολα τα object απ τη φορμα σε ενα test προγραμμα
και αφου εμφανιστει η κυρια οθονη πρόσθετε ενα-ενα τα get κτλ
για να δεις ποιο εχει το πρόβλημα

το DLL μην το πηράξεις

π.χ.

SET RESOURCES TO “WIFTSRN.DLL”

DEFINE DIALOG oF2_Dlg NAME "FORM_2"


ACTIVATE DIALOG oF2_Dlg CENTER

φιλικά

Γιάννης
Post Reply