xBrowse with resource file

Post Reply
reds
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

xBrowse with resource file

Post by reds »

What am I doing wrong

Regards
Peter

Error description: Error FiveWin/2 Duplicated Id: No: 101

Stack Calls
===========
Called from: .\source\classes\DIALOG.PRG => TDIALOG:DEFCONTROL( 366 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CREATEFROMCODE( 1122 )
Called from: C:\_WA\RESTEST1.prg => MAIN( 15 )

Code: Select all


#include 'fivewin.ch'
#include 'xbrowse.ch'
     
function main()

   LOCAL oDlg, oBrw,oBtn2

  USE CUSTOMER NEW ALIAS "CUST"
   
     DEFINE DIALOG oDlg RESOURCE  "IDD_DIALOG1"
   
       REDEFINE XBROWSE oBrw  ID 4002  OF oDlg COLUMNS "First", "City", "State"  ;
                  LINES CELL FASTEDIT DATASOURCE "CUST" 
  
   oBrw:CreateFromCode()
      
   REDEFINE  BUTTON oBtn2  ID 4001  of oDlg   ACTION oDlg:End()    
   ACTIVATE DIALOG oDlg CENTERED

return nil

Code: Select all

// RESOURCE SCRIPT generated by "Pelles C for Windows, version 8.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"

LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL

IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 535, 270
STYLE WS_POPUP|DS_MODALFRAME|DS_3DLOOK|DS_CENTER|WS_CAPTION|WS_SYSMENU|WS_VISIBLE|0x00000008
CAPTION "Dialog"
FONT 8, "Ms Shell Dlg"
{
  CONTROL "Exit", 4001, "Button", WS_TABSTOP, 450, 245, 50, 14
  CONTROL "", 4002, "TXBrowse", WS_TABSTOP|0x00200000, 25, 5, 495, 210
}

 
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: xBrowse with resource file

Post by richard-service »

reds wrote:What am I doing wrong

Regards
Peter

Error description: Error FiveWin/2 Duplicated Id: No: 101

Stack Calls
===========
Called from: .\source\classes\DIALOG.PRG => TDIALOG:DEFCONTROL( 366 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CREATEFROMCODE( 1122 )
Called from: C:\_WA\RESTEST1.prg => MAIN( 15 )

Code: Select all


#include 'fivewin.ch'
#include 'xbrowse.ch'
     
function main()

   LOCAL oDlg, oBrw,oBtn2

  USE CUSTOMER NEW ALIAS "CUST"
   
     DEFINE DIALOG oDlg RESOURCE  "IDD_DIALOG1"
   
       REDEFINE XBROWSE oBrw  ID 4002  OF oDlg COLUMNS "First", "City", "State"  ;
                  LINES CELL FASTEDIT DATASOURCE "CUST" 
  
   oBrw:CreateFromCode()
      
   REDEFINE  BUTTON oBtn2  ID 4001  of oDlg   ACTION oDlg:End()    
   ACTIVATE DIALOG oDlg CENTERED

return nil

Code: Select all

// RESOURCE SCRIPT generated by "Pelles C for Windows, version 8.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"

LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL

IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 535, 270
STYLE WS_POPUP|DS_MODALFRAME|DS_3DLOOK|DS_CENTER|WS_CAPTION|WS_SYSMENU|WS_VISIBLE|0x00000008
CAPTION "Dialog"
FONT 8, "Ms Shell Dlg"
{
  CONTROL "Exit", 4001, "Button", WS_TABSTOP, 450, 245, 50, 14
  CONTROL "", 4002, "TXBrowse", WS_TABSTOP|0x00200000, 25, 5, 495, 210
}

 
I use another

Code: Select all

::oBrw := TXBrowse():New( ::oDlg )

::oCol := ::oBrw:AddCol()
::oCol:cHeader       := "客戶類別編號"
::oCol:nHeadStrAlign := AL_CENTER
::oCol:bStrData      := { || ::oDB:CUSTTY_NO }
::oCol:nWidth        := 150

::oBrw:CreateFromResource( ID )
 
Last edited by richard-service on Thu May 16, 2019 5:09 pm, edited 1 time in total.
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse with resource file

Post by nageswaragunupudi »

No please.

Just remove the line

Code: Select all

  oBrw:CreateFromCode()
 
Do NOT add oBrw:CreateFromResource()
Regards

G. N. Rao.
Hyderabad, India
reds
Posts: 50
Joined: Tue May 16, 2017 12:19 pm
Location: North London

Re: xBrowse with resource file

Post by reds »

Thanks

too busy checking for resource errors to notice the obvious error :-)

Regards
Peter
Post Reply