Help with TListBox

Help with TListBox

Postby reinaldocrespo » Fri Jul 13, 2012 4:20 pm

Hi.

Clicking on a single item of a list box that has been placed on a Folder dialog, causes the dialog to blank. Here is my code:

Code: Select all  Expand view

   REDEFINE LISTBOX ::oLbxNewGroup    VAR nNew ID 1 OF oDlg ITEMS ::aNewGroups  ;
             UPDATE ON DBLCLICK EVAL( bRemove )   WHEN ::lEdit

   REDEFINE LISTBOX ::oLbxActualGroup VAR nAct ID 2 OF oDlg ITEMS ::aActualGroups ;
             UPDATE ON DBLCLICK EVAL( bAdd ) WHEN ::lEdit

 


Here is a screenshot of the dialog before clicking on a single item:
Image

Here is a screen shot after clicking on the 2nd line of the listbox on the left ("Transcription"):
Image

Here is the rc for the dialog:
Code: Select all  Expand view
QUERY_USERGROUPS DIALOG 20, 69, 350, 100
STYLE DS_SETFONT |WS_CHILD |WS_VISIBLE |WS_BORDER
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
  CONTROL "",0,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,2,-2,343,100
  CONTROL "",301,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,164,46,15,14
  CONTROL "",302,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,164,62,15,14
  CONTROL "Available Groups",5,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,187,8,144,8
  CONTROL "Allow Access To Users Who",6,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,12,8,144,8
  CONTROL "Belong To These Groups",7,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,12,16,144,8
  CONTROL "",2,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VISIBLE ,185,26,148,69
  CONTROL "",1,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VISIBLE ,9,26,148,69
END
 

I'm using Fwh 1112 (Dic 2011). Help?


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Help with TListBox

Postby ukoenig » Fri Jul 13, 2012 4:35 pm

Reinaldo,

I can see a defined Groupbox from Resource,
can You test without the Groupbox ?
You must be careful with groupboxes ( position inside the resource )

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Help with TListBox

Postby reinaldocrespo » Fri Jul 13, 2012 4:41 pm

Uwe;

Just tried it. Same result. Here is the new .rc for that folder's dialog:

Code: Select all  Expand view
QUERY_USERGROUPS DIALOG 20, 69, 350, 100
STYLE DS_SETFONT |WS_CHILD |WS_VISIBLE |WS_BORDER
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
  CONTROL "",301,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,164,46,15,14
  CONTROL "",302,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,164,62,15,14
  CONTROL "Available Groups",5,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,187,8,144,8
  CONTROL "Allow Access To Users Who",6,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,12,8,144,8
  CONTROL "Belong To These Groups",7,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,12,16,144,8
  CONTROL "",2,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VISIBLE ,185,26,148,69
  CONTROL "",1,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VISIBLE ,9,26,148,69
END
 


And here is the .rc for the complete dialog.
Code: Select all  Expand view
QUERIES_DLG DIALOG 0, -20, 361, 306
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
CAPTION "Referring Physicians"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
  CONTROL "",1002,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,5,281,354,23
  CONTROL "",131,"txbrowse",WS_CHILD |WS_BORDER |WS_VSCROLL |WS_VISIBLE ,5,5,354,131
  CONTROL "    &New",127,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,5,140,50,14
  CONTROL "      Change",128,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,59,140,50,14
  CONTROL "    &Delete",129,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,113,140,50,14
  CONTROL "    &Save",132,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,167,140,50,14
  CONTROL "      &Cancel",133,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,221,140,50,14
  CONTROL "    E&xit",202,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,296,287,50,14
  CONTROL "    &Print",201,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,238,287,50,14
  CONTROL "",2,"SysTabControl32",WS_CHILD |WS_VISIBLE ,5,157,354,124
END
 


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Help with TListBox

Postby ukoenig » Fri Jul 13, 2012 8:48 pm

Reinaldo,

I think the problem is, Your listboxes are defined for oDlg not for the Folder.

REDEFINE LISTBOX ::oLbxNewGroup VAR nNew ID 1 OF oDlg ITEMS ::aNewGroups ;
UPDATE ON DBLCLICK EVAL( bRemove ) WHEN ::lEdit

REDEFINE LISTBOX ::oLbxActualGroup VAR nAct ID 2 OF oDlg ITEMS ::aActualGroups ;
UPDATE ON DBLCLICK EVAL( bAdd ) WHEN ::lEdit

it should be something like :
REDEFINE FOLDER oFld ID 310 OF oDlg PROMPT aPrompts

Listboxes show on 3. Folderpage :

REDEFINE LISTBOX ::oLbxNewGroup VAR nNew ID 1 OF oFld:aDialogs[ 3 ] ITEMS ::aNewGroups ;
UPDATE ON DBLCLICK EVAL( bRemove ) WHEN ::lEdit

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Help with TListBox

Postby reinaldocrespo » Fri Jul 13, 2012 9:02 pm

I was trying to reduce the code not to overwhelm with details. Here is a more complete view of the code. As you see, oDlg is a parameter and it is oFld:aDialogs[ 3 ] that is being sent as a parameter:

Code: Select all  Expand view

...
   DEFINE DIALOG oDlg RESOURCE "Queries_Dlg" OF oOwner TITLE "System Queries" ;
      TRANSPARENT COLOR CLR_BLACK, RGB(240,240,240)

   REDEFINE FOLDER oFld ID 2 OF oDlg DIALOGS "Query_BasicInfo", "Query_Parameters", "Query_UserGroups" ;
             PROMPT "Query", "Parameters", "User Groups" ;

...
   ::UserGroups( oFld:aDialogs[ 3 ] )

....

*-------------------------------------------------------------------------------------
METHOD UserGroups( oDlg ) CLASS TSysQueries
   LOCAL bAdd, bRemove, cTmp, nNew := 1, nAct := 1

   bRemove := {|| LEN( ::aNewGroups ) > 0 .AND. ;
                 ( AADD( ::aActualGroups, ::aNewGroups[ ::oLbxNewGroup:GetPos() ] ),;
                 ADEL( ::aNewGroups, ::oLbxNewGroup:GetPos(), .T.),;
                 ::oLbxActualGroup:setItems( ::aActualGroups ),;
                 ::oLbxNewGroup:setItems( ::aNewGroups ),;
                 oDlg:update(), .T. ) }

   bAdd   := {|| LEN( ::aActualGroups ) > 0 .AND. ;
                 ( AADD( ::aNewGroups, ::aActualGroups[ ::oLbxActualGroup:GetPos() ] ),;
                 ADEL( ::aActualGroups, ::oLbxActualGroup:GetPos(), .T. ),;
                 ::oLbxActualGroup:setItems( ::aActualGroups ),;
                 ::oLbxNewGroup:setItems( ::aNewGroups ),;
                 oDlg:update(), .T. ) }
   
   REDEFINE LISTBOX ::oLbxNewGroup    VAR nNew ID 1 OF oDlg ITEMS ::aNewGroups  ;
             UPDATE ON DBLCLICK EVAL( bRemove )   WHEN ::lEdit

   REDEFINE LISTBOX ::oLbxActualGroup VAR nAct ID 2 OF oDlg ITEMS ::aActualGroups ;
             UPDATE ON DBLCLICK EVAL( bAdd ) WHEN ::lEdit

   ::oLbxActualGroup:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, EVAL( bRemove ), )  }
   ::oLbxNewGroup:bKeyDown    := {|nkey| IF( nKey = 13 .OR. nKey = 32, EVAL( bAdd ), )  }

   REDEFINE BUTTONBMP ID 302 OF oDlg BITMAP "Dlg_Next" ACTION EVAL( bRemove ) ;
              TOOLTIP "Remove Access from Group" WHEN ::lEdit

   REDEFINE BUTTONBMP ID 301 OF oDlg BITMAP "Dlg_Prev" ACTION EVAL( bAdd )   ;
              TOOLTIP "Add Access to Group" WHEN ::lEdit

RETURN NIL
 


Again, clicking on any single item on the list causes the tab dialog to go blank as shown on screenshots above.



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 65 guests