Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox with several images
Message
From
06/05/1998 09:53:11
 
 
To
06/05/1998 03:31:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00097061
Message ID:
00097302
Views:
31
>Snip...
>>
>>I'll check grid solution. I know how to catch shif, ctrl etc. in mousedown event, but i must remember the las record marked as selected in order to select all records between first and second one. And 'ctrl + shift + click' ?. We'll see...
>Hi Carlos,
>Below code is just a starter. I believe grid is superior to listbox :
>-You have access to all fields
>-Headers are ready
>-Ingrid could be integrated etc etcclear all
>cSQL = "* from employee order by last_name" && Passed as a param
>
>cSQL = stuff(cSQL,atc(" from",cSQL),;
> 0,",.f. as lSelected,.f. as lLastSelected")
>select &cSQL into cursor myCursor
>use dbf("myCursor") in 0 again alias tcSelector
>use in "mycursor"
>select tcSelector
>oSelectorForm = createobject("Form")
>oSelectorForm.height = 400
>oSelectorForm.width = 600
>oSelectorForm.visible = .t.
>oSelectorForm.closable = .f.
>oSelectorForm.addobject("mygrid","grid")
>oSelectorForm.addobject("myQuit1","myQuit")
>with oSelectorForm.mygrid
> .recordmark = .f.
> .deletemark = .f.
> .recordsourcetype = 1
> .recordsource = "tcSelector"
> .columncount=fcount("tcSelector")-2
> for ix=1 to .columncount
> .columns(ix).removeobject("Text1")
> .columns(ix).addobject("myTextBox","myTxtBox")
> .columns(ix).currentcontrol = "myTextBox"
> endfor
> nBackColor = .columns(1).myTextBox.SelectedBackColor
> nForeColor = .columns(1).myTextBox.SelectedForeColor
> .setall("DynamicBackColor","iif(lSelected,"+str(nBackColor)+",rgb(255,255,255))","column")
> .setall("DynamicForeColor","iif(lSelected,"+str(nForeColor)+",rgb(0,0,0))","column")
> .left = 1
> .top = oSelectorForm.myQuit1.top + oSelectorForm.myQuit1.height + 2
> .width = .parent.width - 2
> .height = .parent.height - .top - 2
> .visible = .t.
>endwith
>oSelectorForm.myQuit1.visible = .t.
>oSelectorForm.show
>read events
>
>define class myquit as commandbutton
>left=1
>top=1
>Caption="Close"
>procedure click
> clear events
>endproc
>enddefine
>
>define class myTxtBox as TextBox
>BorderStyle = 0
>procedure gotfocus
> this.backcolor = this.SelectedBackColor
> this.forecolor = this.SelectedForeColor
>endproc
>procedure lostfocus
> this.backcolor = rgb(255,255,255)
> this.forecolor = rgb(0,0,0)
>endproc
>
>procedure mousedown
>lparameters nButton, nShift, nXCoord, nYCoord
>thisform.lockscreen = .t.
>if nButton = 1
> nodefault
> do case
> case nShift = 1
> case nShift = 2
> otherwise
> nCurrec = recno()
> replace all lSelected with .f., lLastSelected with .f.
> go nCurrec
> replace lSelected with .t., lLastSelected with .t.
> endcase
>endif
>thisform.lockscreen = .f.
>endproc
>enddefineCetin


Cetin, in my ignorance, i think with this code you has solved the click event, but not the 'ctrl + click' and 'shift + click' and 'ctrl + shift + click' in order to imitate the behavior of multiselect listbox. I know this is possible using the nshift parameter, but as i said i must to remember the last record selected to select all records between both of them and so on.

In addition of problems, the images showed in each record may be different. Is this possible in a grid ?. If i use a oleboundcontrol bounded to a general field of a cursor, performance will reduce a lot. Not in a listbox. The application is a documental one. You have folders, sub-folders and in each one of this folders you can have word documents, excel sheets, scanned images etc. So i want to show a different image for each type of document. In addition i want to show the user with a image if the document has notepads or relationed documents etc.

The problem is biggest than apparience. Isn't it ??
thanks again.
Saludos,
A.G.P.
---------
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform