Ollie,
First, this line works fine (modified from yours):
- Code: Select all Expand view
REDEFINE DBCOMBO cTAG ID 30 of oDlg_Search ;
items aTAGLIST list aTAGLIST UPDATE ON CHANGE msgInfo(cTag)
Next your line won't work because oListbox is a local and it is being called within the DBCombo class so it crashes.
- Code: Select all Expand view
REDEFINE DBCOMBO cTAG ID 30 of oDlg_Search items aTAGLIST list aTAGLIST ;
UPDATE ON CHANGE (MSGINFO(cTAG),TEST->(ORDSETFOCUS(cTAG)),oListBox:REFRESH())
I don't know how you are seeing the strange results you are getting because the program crashes on me after displaying the msgInfo(). Ah, perhaps you have oListbox defined as a public?
Here is another problem. You have defined a LISTBOX in Workshop. This is a windows control called "listbox" which is not the same as the control we also call "listbox" in FW. They both are defined like this:
Redefine listbox oLbx...
But if there is a FIELDS clause, then it gets preprocessed into TWBrowse instead of TListbox (see \include\fivewin.ch). The listbox you have defined in Workshop is the Windows control, but the one you have REDEFINED in your code is a TWBrowse. It will compile this way but it will not work properly.
To use a TWBrowse in Workshop you have to define a custom control and name it TWBrowse. You have to create this custom control because it is not a standard windows control that Workshop already knows about.
There is also another way do go about what you are trying to do, and that is you can assign actions to the TWBrowse headers. Below are some notes from my notes file on how to do this. This way you don't even need to use the dbcombo.
If you don't like using the header actions, try fixing the above problems instead.
James
------------------------
Header Actions
You can attach actions to column headers using the ACTION clause. Here is an example of sorting columns:
- Code: Select all Expand view
method browse()
...
@0,0 listbox oLbx...
::setHeaders(oLbx)
oLbx:aActions:={ {|| ::action(1,oLbx)}, {||::action(2,oLbx)} }
...
return self
method action(nOrder,oLbx)
::setOrder(nOrder)
::gotop()
oLbx:gotop()
oLbx:refresh()
::setHeaders(oLbx)
return nil
method setHeaders(oLbx)
oLbx:aHeaders:={;
if(::indexOrder()=1,"CustNo*","CustNo"), ;
if(::indexOrder()=2,"Item*","Item"), ;
"Price","Start","End";
}
return nil
(To provide a visual indication of the sorted column you mark the headers with an asterisk. )
-------------------------------------------