topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
Combobox changing aitems dynimacaly | Hello,
I try to use comboxes , and change oCombox:aItems in the dialog.
I started with samples/Combox.prg , and try to change oCbx2:aItems (second combobox)
1)oCbx2:bGotFocus := ;
{|| oCbx2:aItems := { "1:One", "2:CHANGED", "3:Three" } }
The second combobox receives no visible focus , clicking shows the old items
bWhen shows focus , but the result is also bad
2) I tryed to use the VALID clausule from the first combobox :
VALID ( msginfo("ok") , oCbx2:aItems := { "1:One", "2:CHANGED", "3:Three" } , .T. )
BUT , THIS IS NOT EXECUTED , MSGINFO HAS NO EFFECT !!!!!!!!!
Frank |
Combobox changing aitems dynimacaly | [quote="Frank Demont":3cfal3wu]
I try to use comboxes , and change oCombox:aItems in the dialog.
I started with samples/Combox.prg , and try to change oCbx2:aItems (second combobox)
1)oCbx2:bGotFocus := ;
{|| oCbx2:aItems := { "1:One", "2:CHANGED", "3:Three" } }
The second combobox receives no visible focus , clicking shows the old items
bWhen shows focus , but the result is also bad
2) I tryed to use the VALID clausule from the first combobox :
VALID ( msginfo("ok") , oCbx2:aItems := { "1:One", "2:CHANGED", "3:Three" } , .T. )
BUT , THIS IS NOT EXECUTED , MSGINFO HAS NO EFFECT !!!!!!!!!
Frank[/quote:3cfal3wu]
Try this codeblock :
@ nRow, nCol COMBOBOX oCbx VAR cPav PIXEL UPDATE VALID !empty( cPav ) OF oDlg SIZE n, nFh * 4
aeval( MyArray, { |x| aadd( oCbx:aItems, x[ 2 ] ) } ) // for multidimensional array .
or
aeval( MyArray, { || aadd( oCbx:aItems, MyArray ) } )
I'm changing my comboboxec at runtine in this way . Maybe it helps .
With best regards ! Rimantas |
Combobox - Restablecer orden | Gente:
Al agregar un ítem en un Combobox pretendo que luego este se vea ordenando alfabéticamente.
Leyendo en la clase observo que no existe un :Sort() por lo que luego de hacer:
oCmb:Add( "Mi dato" ), hago
aSort( oCmb:aItems )
oCmb:Refresh()
Y, el efecto no es el deseado, ya que "Mi dato" sigue al final de la lista.
Se puede restablecer el orden en un Combobox?
gracias, Saludos |
Combobox - Restablecer orden | [quote="MarioG":3vwy0ds4]Gente:
Al agregar un ítem en un Combobox pretendo que luego este se vea ordenando alfabéticamente.
Leyendo en la clase observo que no existe un :Sort() por lo que luego de hacer:
oCmb:Add( "Mi dato" ), hago
aSort( oCmb:aItems )
oCmb:Refresh()
Y, el efecto no es el deseado, ya que "Mi dato" sigue al final de la lista.
Se puede restablecer el orden en un Combobox?
gracias, Saludos[/quote:3vwy0ds4]
Si es por recursos, hay una propiedad que hace lo que necesitas |
Combobox - Restablecer orden | Mario,
oCmb:Add( "Mi dato" ), hago
aTmpItems := ACLONE( oCmb:aItems )
aSort( aTmpItems )
oCmb:SetItems( aTmpItems )
oCmb:Refresh()
No lo probé, pero supongo deberia funcionar.
Saludos |
Combobox - Restablecer orden | Williams; no son problemas de recursos
Pedro; anduvo!
muchas gracias |
Combobox - bValid | Hi all
i have problem with evaluation combobox in 13.07
my code like this:
[code=fw:1gr0ue49]<div class="fw" id="{CB}" style="font-family: monospace;">..<br />..<br /> <span style="color: #0000ff;">redefine</span> <span style="color: #0000ff;">combobox</span> ocb1 <span style="color: #0000ff;">var</span> cstatus <span style="color: #0000ff;">id</span> <span style="color: #000000;">20</span> <span style="color: #0000ff;">of</span> oDlg <span style="color: #0000ff;">items</span> aStatus<br /> ocb1:<span style="color: #000000;">bchange</span> := <span style="color: #000000;">{</span>|| cstatus := astatus<span style="color: #000000;">[</span>ocb1:<span style="color: #000000;">nAt</span><span style="color: #000000;">]</span> <span style="color: #000000;">}</span><br /><br /> ocb1:<span style="color: #000000;">bvalid</span> := <span style="color: #000000;">{</span>|| <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span> cstatus <span style="color: #000000;">)</span>, ; <span style="color: #B900B9;">// result: cstatus always empty......... why....?</span><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> empty<span style="color: #000000;">(</span>cstatus<span style="color: #000000;">)</span>, .F., .T. <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:1gr0ue49]
in old version the code is no problem....
any solution...?
Regards
Mulyadi |
Combobox - bValid | The problem is SOLVED.
in my setting file .RMK, the parameter build is 13.04
consequence from COPY-PASTE <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
Combobox / Combometro | Adjunto código e imagen utilizando ambos controles
Es la primera vez que utilizo combometro, es correcto el código?
[code=fw:1lr2ov7n]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> @ nFIG+nInc*<span style="color: #000000;">4</span><span style="color: #000000;">+4</span>, nCIG<span style="color: #000000;">+80</span> COMBOMETRO oTipos <span style="color: #0000ff;">VAR</span> cTipoEx ;<br /> <span style="color: #0000ff;">ITEMS</span> aTipo ;<br /> <span style="color: #0000ff;">SIZE</span> Int<span style="color: #000000;">(</span>nW*<span style="color: #000000;">0.68</span><span style="color: #000000;">)</span>, <span style="color: #000000;">190</span> ; <span style="color: #B900B9;">//Int(nH*0.9) ;</span><br /> <span style="color: #0000ff;">OF</span> oPnel1 ;<br /> <span style="color: #0000ff;">COLOR</span> METRO_GRIS1, METRO_WINDOW ; <span style="color: #B900B9;">//METRO_APPWORKSPACE, METRO_WINDOW</span><br /> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFontX<br /><br /> </div>[/code:1lr2ov7n]
[url=http://imageshack.us/photo/my-images/593/91c0.png/:1lr2ov7n][img:1lr2ov7n]http://img593.imageshack.us/img593/4449/91c0.png[/img:1lr2ov7n][/url:1lr2ov7n]
Y con Combobox:
[code=fw:1lr2ov7n]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> @ nFI+nInc*<span style="color: #000000;">4</span><span style="color: #000000;">+4</span>, nCIG<span style="color: #000000;">+80</span> <span style="color: #0000ff;">COMBOBOX</span> oTipos <span style="color: #0000ff;">VAR</span> cTipoEx ;<br /> <span style="color: #0000ff;">ITEMS</span> aTipo ;<br /> <span style="color: #0000ff;">OF</span> oPnel1 ;<br /> <span style="color: #0000ff;">SIZE</span> Int<span style="color: #000000;">(</span>nW*<span style="color: #000000;">0.68</span><span style="color: #000000;">)</span>, <span style="color: #000000;">190</span> ; <span style="color: #B900B9;">//275</span><br /> <span style="color: #0000ff;">FONT</span> oFontX ; <span style="color: #B900B9;">// STYLE CBS_DROPDOWN LIST ;</span><br /> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">COLOR</span> METRO_GRIS1, METRO_WINDOW<br /> </div>[/code:1lr2ov7n]
[url=http://imageshack.us/photo/my-images/845/9vcy.png/:1lr2ov7n][img:1lr2ov7n]http://img845.imageshack.us/img845/3144/9vcy.png[/img:1lr2ov7n][/url:1lr2ov7n]
Creo que el código en ambos casos es equivalente
Y una pregunta más, es posible que el combobox no exceda su tamaño del control que lo contiene? |
Combobox / Combometro | Cristobal,
Tienes un ejemplo de uso de ComboMetro en FWH\samples\touch.prg |
Combobox / Combometro | Cristóbal,
Muy lindo ese Dbu, es el look del futuro.
¿Dónde se puede encontrar?.
Gracias;)) |
Combobox / Combometro | Elvira, disculpa la intromisión pero es que me lo has puesto que ni pintado.
De acuerdo en que será el futuro inmediato porque así lo ha decidido Microsoft, pero lo de lindo discrepo absolutamente. Aunque claro, sobre gustos.... ya se sabe. |
Combobox / Combometro | Elvira, espero tenerlo terminado en esta semana, muchas gracias
Manuel, permíteme el siguiente comentario:
La mayor parte de mi tiempo desde hace muchos años lo he dedicado a realizar pruebas sobre "pantallas" de aplicaciones, ya que los desarrollos que hacemos han de evolucionar no solo a nivel técnico sino también, y muy importante, por temas comerciales, a nivel estético, y, al final, he tenido que "sucumbir" ante lo que el standard marcaba (desde Windows 3.0, yo usaba Clipper cuando apareció Fivewin). Por lo que en general mis gustos quedaron para decidir qué colores, fonts, etc utilizar y alguna modificacion en algun control o en la colocacion de los mismos.
Ahora ya ni eso, está todo escrito y detallado: colores, fonts, etc.
Qué le vamos a hacer!, yo hace tiempo que me resigné, y que conste que en muchos momentos he pensado como tú.
Agradezco tu sincero comentario |
Combobox / Combometro | [quote="Antonio Linares":1izosrsz]Cristobal,
Tienes un ejemplo de uso de ComboMetro en FWH\samples\touch.prg[/quote:1izosrsz]
Antonio, ya lo habia mirado, pero se me habia pasado el detalle que el nHeigth que ponemos en el comando corresponde a la altura del "antiguo Get del Combobox" y no a la altura total del control como era antes, por eso no me aparecía correctamente: lo toma como altura de cada fila de la lista.
Ya me aparece correctamente:
[url=http://imageshack.us/photo/my-images/43/9sfg.png/:1izosrsz][img:1izosrsz]http://img43.imageshack.us/img43/6646/9sfg.png[/img:1izosrsz][/url:1izosrsz] |
Combobox / Combometro | Cristóbal,
¿Y cómo solucionas lo del preview?.
La ventana que usas y usa el look Metro ocupa toda la pantalla y oculta la barra de inicio e inferior, pero el preview actual no ocupa todo y no se acabaría de ver bien.
Muchas gracias por compartir tus interfaces tan bonitos <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
Combobox / Combometro | [quote="elvira":uu4bsghb]Cristóbal,
¿Y cómo solucionas lo del preview?.
La ventana que usas y usa el look Metro ocupa toda la pantalla y oculta la barra de inicio e inferior, pero el preview actual no ocupa todo y no se acabaría de ver bien.
Muchas gracias por compartir tus interfaces tan bonitos <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->[/quote:uu4bsghb]
Muy buena reflexion, gracias
(En el siguiente link mirar el párrafo "Barras de la Aplicacion")
[url:uu4bsghb]http://msdn.microsoft.com/es-es/library/windows/apps/hh465330.aspx[/url:uu4bsghb]
[url:uu4bsghb]http://msdn.microsoft.com/es-es/library/windows/apps/hh872191.aspx[/url:uu4bsghb]
La idea es la misma: sacar la barra de botones al subir el mouse a la parte de arriba de la pantalla ( o abajo )
Algo parecido a esto: muestro la barra superior (en este momento vacia, para poner un TBar, Lista de imagenes, etc, aun por decidir)
[url=http://imageshack.us/photo/my-images/5/wq0z.png/:uu4bsghb][img:uu4bsghb]http://img5.imageshack.us/img5/8458/wq0z.png[/img:uu4bsghb][/url:uu4bsghb] |
Combobox / Combometro | Cristóbal,
Muy bonito la verdad.
Mira, para el preview quizás podría servirte esto:
[img:23qebumz]http://i39.tinypic.com/2s7828i.png[/img:23qebumz]
Sería cuestión de hablar con Antonio para meter un nuevo estilo metro en el rpreview.prg, porque el diseño actual no casa bien con este nuevo look, que nos guste o no, es el marcado por Microsoft en Office y el que los usuarios esperan encontrar.
Enhorabuena por tu diseño. |
Combobox / Combometro | Lucas, gracias
Tu diseño es impecable, tanto en la elección de colores como de iconos (en eso es en lo que estoy trabajando yo). Me encanta como concepto y se nota que hay mucho, mucho trabajo detrás.
Además, a la hora de pasar el resultado del informe a "Html", el resultado sería prácticamente el mismo.
Mi más sincera enhorabuena.
Y como se suele decir, "una imagen vale más que mil palabras", y así es más fácil que podamos enriquecernos todos.
No hay muchas personas que estén dispuestos a exponer en público sus diseños.
Cuenta con mi apoyo en el comentario que realizas sobre el cambio de "look", no solo al Preview sino en general a todo lo demás, que es mi objetivo, ya que como comentas es el "standard" que nos vemos obligados a seguir. Y, a decir verdad, lo que empezó siendo una prueba, cada vez me convence más. |
Combobox AutoFill | In earlier versions of FWH, I had the ability to use a CBS_DROPDOWN Combobox control that would auto fill from the array when someone started typing the characters. I had a combobox.prg dated 8/7/13 that I was linking into my app.
With my current version 15.09 b5 that capability is not included. Perhaps I missed a change somewhere ?
I don't want to link in the old .prg because much has changed. However, I know my clients appreciate that feature and do not want it gone.
Can anyone provide some guidance ? Thanks. |
Combobox AutoFill | Tim,
Have you tried oComboBox:lIncSearch := .T. ? |
Combobox AutoFill | OK ... apparently I missed that in the notes.
I looked in the Wiki ... both the command and class ... not mentioned
I looked at the source and missed it in the DATA line
I need to remember to also do a search in WhatsNew ...
Anyway that is what I need. Thanks. |
Combobox Busqueda Incremental | Hola amigos
Estoy pasando mi codigo de la FWH 9.06 a la FWH 10.10 y me he encontrado, que la busqueda incremental (incremental search) en la clase combobox no trabaja correctamente en esta version.
Alguien ha hallado como solucionar este problema?
Saludos |
Combobox Busqueda Incremental | Hola
Olvide mencionar que es desde recursos.
Y por cierto en el combobox tipo CBS_SIMPLE, la busqueda funciona perfectamente, no asi en CBS_DROPDOWNLIST, al omitir
[code=fw:3ofhczr4]<div class="fw" id="{CB}" style="font-family: monospace;"> oGet<span style="color: #000000;">[</span><span style="color: #000000;">6</span><span style="color: #000000;">]</span>:<span style="color: #000000;">lIncSearch</span> := .T. && Activa busqueda incremental<br /> </div>[/code:3ofhczr4]
Busca solo la primera letra, en la version 9.06 funcionaba con el codigo anterios, alguien tiene algun hilo que hacer en esta version <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
Saludos |
Combobox Busqueda Incremental | aprovechando tu post
con esta funcion se puede realizar la busqueda tipo google?
al ir escribiendo va mostrando los registros que van cumpliendo con dicha busqueda, es posible?
gracias anticipadas
Tomas Hernandez |
Combobox Busqueda Incremental | Hola Tomas
Bueno cuando funcionaba...
Te ubicaba a medida que escribias en el elemento a que correspondia.
Lo que hace la busqueda de google es filtrar, y eso se puede hacer pero el problema es que los combos se cargan a memoria, y cuando las tablas crecen, dejan de ser amigables convirtiendose en largas esperas <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> ; aun el DBCOMBO trabaja subiendo los valores de la tabla a memoria, no se gestionan los registros sino arreglos de memoria. |
Combobox Busqueda Incremental | Hola
He intentado compilar la clase Combobox de la FWH 9.06, que era con la que me funcionaba la busqueda incremental,y despues de hacer un par de malabares funciono, Ya que en la FWH 10.10 no anda bien
Espero no tener lios con otras clases, me preocupa la clase Get, veremos |
Combobox Busqueda Incremental | Una pregunta en la 11.08
Ya se soluciono esto de la busqueda incremental ??
Estos detalles podran parecer pequeños, pero soy muy significantes al menos en mis aplicaciones <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> |
Combobox Busqueda Incremental | [quote="Blessed":39nasxma]Hola Tomas
Bueno cuando funcionaba...
Te ubicaba a medida que escribias en el elemento a que correspondia.
Lo que hace la busqueda de google es filtrar, y eso se puede hacer pero el problema es que los combos se cargan a memoria, y cuando las tablas crecen, dejan de ser amigables convirtiendose en largas esperas <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> ; aun el DBCOMBO trabaja subiendo los valores de la tabla a memoria, no se gestionan los registros sino arreglos de memoria.[/quote:39nasxma]
gracias por responder
tendrás algún ejemplo? para revisarlo ?
gracias |
Combobox Busqueda Incremental | // CAMBIOS EN LA CLASE DBCOMBO.PRG ... Y ME ESTA FUNCIONANDO
CLASS TDBCombo FROM TComboBox
DATA cSearchBackup // JOHNSON RUSSI - DIC 20 DE 2011
///
METHOD New( nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId, ;
bChange, bValid, nClrFore, nClrBack, lPixel, oFont, ;
cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, ;
cAlias, cFldItem, cFldList, aList ) CLASS TDBCombo
DEFAULT cAlias := alias(), ;
cFldList := "", ;
cFldItem := "", ;
aList := {},;
aItems:= {}
::aList := aList
::aItems := aItems
::cAlias := cAlias
::cFldList := cFldList
::cFldItem := cFldItem
::cSearchKey:=""
::cSearchBackup :="" // JOHNSON RUSSI - DIC 20 DE 2011
METHOD KeyChar( nKey, nFlags) CLASS TDBCombo
local nNewAT := 0, nOldAT:=::nAT
::cSearchKey := ::cSearchBackup // JOHNSON RUSSI - DIC 20 DE 2011
// Incremental search
if nKey = VK_BACK // VK_BACK RESETEA L ABUSQUEDA , SE QUITA EL VK_SPACE , PARA PODER BUSCAR EN ORACIONES : "NOTA CREDITO" // JOHNSON RUSSI - DIC 20 DE 2011
::cSearchKey := ""
::cSearchBackup := "" // JOHNSON RUSSI - DIC 20 DE 2011
::Set( If( ValType( Eval( ::bSetGet ) ) == "N", 1, ::aItems[ 1 ] ) )
else
if nKey = 45 // CON EL SIGNO (-) BORRA ULTIMO CARACTER JOHNSON RUSSI - DIC 20 DE 2011
::cSearchKey := left(::cSearchKey,Len(::cSearchKey)-1)
else
::cSearchKey += upper(chr(nKey))
endif
::cSearchBackup := ::cSearchKey // JOHNSON RUSSI - DIC 20 DE 2011
nNewAT := ascan(::aList, {|x| subs(upper(x),1,len(::cSearchKey)) == ::cSearchKey} ) // JOHNSON RUSSI - DIC 20 DE 2011 |
Combobox Busqueda Incremental 11.09 | Hola a todos
Trasladando mi codigo a la FWH 11.09, di con un problema en la busqueda incremental en los combobox en:
[code=fw:4yipcqaq]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">METHOD</span> KeyChar<span style="color: #000000;">(</span> nKey, nFlags <span style="color: #000000;">)</span></div>[/code:4yipcqaq]
la linea 568
[code=fw:4yipcqaq]<div class="fw" id="{CB}" style="font-family: monospace;"> nNewAt = AScan<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, <span style="color: #000000;">{</span> | x | Upper<span style="color: #000000;">(</span> x <span style="color: #000000;">)</span> == ::<span style="color: #000000;">cSearchKey</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span></div>[/code:4yipcqaq]
Es necesario sustituir el exactamente '==' por igual '=' ya que en caso contrario no anda; un lapsus.
Saludos, espero les sirva |
Combobox Busqueda Incremental 11.09 | muchas gracias por tu gentileza.
el problema lleva tiempo.
a ver si lo incluyen en fw 11.10. |
Combobox Con boton Más grande | Muy buenas, ¿alguien me podría decir como puedo agrandar el boton del combobox y de la lista horizontal?
Un Saludo. |
Combobox Con boton Más grande | Juan,
El combobox pinta su propio boton, asi que no puede cambiarse. |
Combobox Data | To All
I am migrating an application and I have a field called Status which I am using in a combobox .. However I ran across a problem .. what happens if the data in the table ( in this case = "Dispute" ) is not found in the array aStatus ? .. apparently cStatus is not found even though the data for cStatus = "Dispute" .. but the value that shows in the combobox is blank ..
Is there a way to over-ride that behavior if cStatus is not found in aStatus so that if cStatus is not found, at least cStatus will be visible in the combobox field?
Thanks
Rick Lipkin
[code=fw:2e0rzk23]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Local</span> oStatus,cStatus,aStatus<br /><br />aStatus := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br />aadd<span style="color: #000000;">(</span> aStatus, <span style="color: #ff0000;">"All"</span><span style="color: #000000;">)</span><br />aadd<span style="color: #000000;">(</span> aStatus, <span style="color: #ff0000;">"Active"</span> <span style="color: #000000;">)</span><br /><br /><br />cStatus := a->Status <span style="color: #B900B9;">// "Dispute"</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oStatus <span style="color: #0000ff;">var</span> cStatus <span style="color: #0000ff;">ID</span> <span style="color: #000000;">148</span> <span style="color: #0000ff;">of</span> oInvt ;<br /> <span style="color: #0000ff;">ITEMS</span> aStatus <span style="color: #0000ff;">when</span> cMode <> <span style="color: #ff0000;">"V"</span><br /> oStatus:<span style="color: #000000;">SetFont</span><span style="color: #000000;">(</span> oFontB <span style="color: #000000;">)</span><br /> oStatus:<span style="color: #000000;">lIncSearch</span> = .T.<br /><br /> </div>[/code:2e0rzk23] |
Combobox Data | Rick,
Is sounds like you have a referential integrity issue. Can't you just add "Dispute" to the array, or are there lots more possible items that aren't in the list?
If so, you could create a UNIQUE index on the field and use that data to load the array. But I do wonder how data that was not allowed got into the field?
James |
Combobox Data | James
I am in the process of converting some old Excel data and this data is a mess. As I import the data I am building the lookup tables as I go, so technically, the imported data will be in the lookup tables I create as I loop thru excel.
My question is two fold .. what happens if someone deletes a record in one of the look up tables and as I build my array for the combobox during data entry, that value is missing from the array so when I edit or view the main table that has the value .. since that field value was not found in the array . the combobox value is blank.
If there is no other way around this, I will prob abandon the combobox and just use a field with a look up table.
Rick Lipkin |
Combobox Data | Rick,
[quote:bgfx0ndm]My question is two fold .. what happens if someone deletes a record in one of the look up tables and as I build my array for the combobox during data entry[/quote:bgfx0ndm]
I would question why would you allow anyone to do that? Shouldn't the table be built by you and maintained by you, and maybe an admin? Actually, for integrity you can't allow any item to be deleted from the table once it has been used.
[quote:bgfx0ndm]...that value is missing from the array so when I edit or view the main table that has the value .. since that field value was not found in the array . the combobox value is blank.[/quote:bgfx0ndm]
There is a method add( cItem, nAt) for the combobox, so technically you could add it on the fly. But, I still maintain that you should build the lookup table and never delete anything from it. Anything else is going to create a nightmare.
I also note that you should always have a blank entry in the lookup table. Consider what will happen if you don't. During data entry of a new record, what if a user doesn't know or have the answer for that field. Since it is a constrained field, the user is forced to select something, so instead of getting no data, you get incorrect data. An empty field is easy to find later, but incorrect data is just about impossible to find.
There is a similar problem with radio buttons--no blank option.
Regards,
James |
Combobox Data | James
If I keep the comboboxes .. I will definitely only allow deletes on the look up data .. only if I check to see if the value exists in the main table .. I haven't made up my mind yet .. I like the incremental search feature of the combobox, but I use Get\Action to fire off a data validation browse .. that way I have my regular get instead of the combobox value .. Don;t know what I am going to do yet.
Rick Lipkin |
Combobox Data | Rick,
[quote:4fogbtn6]If I keep the comboboxes .. I will definitely only allow deletes on the look up data .. only if I check to see if the value exists in the main table .. [/quote:4fogbtn6]
I'm not clear what you are saying. It sounds like you said just the opposite of what I would expect--only allow deletes on the lookup data if the value DOES NOT exist in the main table. Is that what you meant?
Generally I would only allow additions to the lookup table, never deletions. Then I don't think I have ever dealt with the situation where we needed to remove an option for all future records.
Is the purpose of the combobox to limit users to specific choices, or are these just suggestions? Maybe if you provided more details, I could offer more relevant suggestions.
James |
Combobox Data | James
I am multi-tasking .. If I allow deletes on the look up tables .. I will first look to the main data to see if that value exists .. if it does .. I WILL NOT allow any deletes on the lookup data that makes up the Ccombobox array.
Sorry for the confusion
RIck Lipkin |
Combobox Data | Rick,
Got it.
Multitasking--the life of every programmer. I think we are all prematurely wearing out our brains...
James |
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST | To All
I have built a Combobox from Resource and using the styles CBS_DROPDOWN ( preferred ) and CBS_DROPDOWNLIST ( do not want to use ) has profound font differences when you want to disable the control with this syntax :
[code=fw:skrsc9oy]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oCategory <span style="color: #0000ff;">var</span> cCategory <span style="color: #0000ff;">ID</span> <span style="color: #000000;">153</span> <span style="color: #0000ff;">of</span> oCont ;<br /> <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Contact Person"</span>,<span style="color: #ff0000;">"Sales Rep"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">when</span> cMode <> <span style="color: #ff0000;">"V"</span> <span style="color: #0000ff;">COLOR</span> CLR_BLACK,<span style="color: #000000;">14869218</span><br /> </div>[/code:skrsc9oy]
Here is the snipit from the Resource file with the style definitions for each example :
[code=fw:skrsc9oy]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">COMBOBOX</span> <span style="color: #000000;">153</span>, <span style="color: #000000;">78</span>, <span style="color: #000000;">21</span>, <span style="color: #000000;">181</span>, <span style="color: #000000;">33</span>, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP<br /> </div>[/code:skrsc9oy]
Screen shot with CBS_DROPDOWN
[url=http://imageshack.us/photo/my-images/684/dropdown.jpg/:skrsc9oy][img:skrsc9oy]http://imageshack.us/a/img684/3746/dropdown.jpg[/img:skrsc9oy][/url:skrsc9oy]
and here is the same Resource with CBS_DROPDOWNLIST
[code=fw:skrsc9oy]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">COMBOBOX</span> <span style="color: #000000;">153</span>, <span style="color: #000000;">78</span>, <span style="color: #000000;">21</span>, <span style="color: #000000;">181</span>, <span style="color: #000000;">33</span>, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP<br /> </div>[/code:skrsc9oy]
Screen shot with CBS_DROPDOWNLIST
[url=http://imageshack.us/photo/my-images/441/dropdownlist.jpg/:skrsc9oy][img:skrsc9oy]http://imageshack.us/a/img441/4783/dropdownlist.jpg[/img:skrsc9oy][/url:skrsc9oy]
I do not like the disabled font or appearance of the CBS_DROPDOWN however, I have chosen that style because I need to be able to Add or Edit a value not in the ITEM array.
Is there a way to work around on the disabled CBS_DROPDOWN to modify the text to look like the CBS_DROPDOWNLIST ?
I have tried to over-ride the font with oCategory:SetFont( oFont ) but it has no effect. Any help or advice would be appreciated.
Thanks
Rick Lipkin |
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST | Try assigning the system font
[code=fw:rrwtirsu]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> GetSysFont<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">-12</span></div>[/code:rrwtirsu]
to the combobox.
EMG |
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST | Enrico
I have tried your suggestion and applied the font to the Dialog
[code=fw:loexhbwt]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> GetSysFont<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">-12</span><br />...<br />...<br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oCont <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CONTVIEW"</span> ;<br /> <span style="color: #0000ff;">TITLE</span> xTITLE <span style="color: #0000ff;">FONT</span> oFont<br /> </div>[/code:loexhbwt]
as well as to the Combobox with no effect .. when you redefine a combobox from resource there is no 'font' option in FiveWin.ch, however there is a 'font' option if you create from code.
[code=fw:loexhbwt]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oCategory <span style="color: #0000ff;">var</span> cCategory <span style="color: #0000ff;">ID</span> <span style="color: #000000;">153</span> <span style="color: #0000ff;">of</span> oCont ;<br /> <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Contact Person"</span>,<span style="color: #ff0000;">"Sales Rep"</span>,<span style="color: #ff0000;">"Accounting"</span>, <span style="color: #ff0000;">"Technical Support"</span>, <span style="color: #ff0000;">"Shipping Dept"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">when</span> cMode <> <span style="color: #ff0000;">"V"</span> <span style="color: #B900B9;">//COLOR CLR_BLACK,14869218</span><br /> oCategory:<span style="color: #000000;">SetFont</span><span style="color: #000000;">(</span> oFont <span style="color: #000000;">)</span><br /> oCategory:<span style="color: #000000;">SetColor</span><span style="color: #000000;">(</span>nRgb<span style="color: #000000;">(</span><span style="color: #000000;">7</span>,<span style="color: #000000;">7</span>,<span style="color: #000000;">224</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> </div>[/code:loexhbwt]
Please compile this sample code and you will see what I mean .. notice the difference in the two results .. the top is a Dropdown and the second is Dropdownlist.
Thanks
Rick Lipkin
[code=fw:loexhbwt]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//-------------------------</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oCbx, cMode, cItem,oCbx1,cItem1<br /><br /> cMode := <span style="color: #ff0000;">"V"</span><br /> cItem := <span style="color: #ff0000;">"Testing"</span><br /> cItem1 := <span style="color: #ff0000;">"Testing"</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"TestCombo"</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oCbx <span style="color: #0000ff;">VAR</span> cItem <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Testing"</span>, <span style="color: #ff0000;">"this"</span>, <span style="color: #ff0000;">"ComboBox"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">110</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">when</span> cMode <> <span style="color: #ff0000;">"V"</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oCbx1 <span style="color: #0000ff;">VAR</span> cItem1 <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Testing"</span>, <span style="color: #ff0000;">"this"</span>, <span style="color: #ff0000;">"ComboBox"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">111</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">200</span> <span style="color: #0000ff;">OF</span> oDlg;<br /> <span style="color: #0000ff;">ACTION</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:loexhbwt]
TestCombo.rc
[code=fw:loexhbwt]<div class="fw" id="{CB}" style="font-family: monospace;"><br />TestCombo <span style="color: #0000ff;">DIALOG</span> <span style="color: #000000;">49</span>, <span style="color: #000000;">30</span>, <span style="color: #000000;">124</span>, <span style="color: #000000;">102</span><br /><span style="color: #0000ff;">STYLE</span> DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU<br />CAPTION <span style="color: #ff0000;">"Testing a ComboBox "</span><br /><span style="color: #0000ff;">FONT</span> <span style="color: #000000;">6</span>, <span style="color: #ff0000;">"MS Sans Serif"</span><br /><span style="color: #000000;">{</span><br /> LTEXT <span style="color: #ff0000;">"A ComboBox"</span>, <span style="color: #000000;">-1</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">43</span>, <span style="color: #000000;">8</span><br /> <span style="color: #0000ff;">COMBOBOX</span> <span style="color: #000000;">110</span>, <span style="color: #000000;">6</span>, <span style="color: #000000;">16</span>, <span style="color: #000000;">72</span>, <span style="color: #000000;">31</span>, CBS_DROPDOWN | WS_TABSTOP<br /> PUSHBUTTON <span style="color: #ff0000;">"&End"</span>, <span style="color: #000000;">200</span>, <span style="color: #000000;">86</span>, <span style="color: #000000;">86</span>, <span style="color: #000000;">33</span>, <span style="color: #000000;">12</span><br /> <span style="color: #0000ff;">COMBOBOX</span> <span style="color: #000000;">111</span>, <span style="color: #000000;">6</span>, <span style="color: #000000;">45</span>, <span style="color: #000000;">72</span>, <span style="color: #000000;">31</span>, CBS_DROPDOWNLIST | WS_TABSTOP<br /><span style="color: #000000;">}</span><br /> </div>[/code:loexhbwt]
[url=http://imageshack.us/photo/my-images/546/combm.jpg/:loexhbwt][img:loexhbwt]http://imageshack.us/a/img546/5412/combm.jpg[/img:loexhbwt][/url:loexhbwt] |
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST | [code=fw:1n8rmdaz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//-------------------------</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oCbx, cMode, cItem,oCbx1,cItem1<br /><br /> <span style="color: #00C800;">local</span> oFont<br /><br /> cMode := <span style="color: #ff0000;">"V"</span><br /> cItem := <span style="color: #ff0000;">"Testing"</span><br /> cItem1 := <span style="color: #ff0000;">"Testing"</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> GetSysFont<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">-12</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"TestCombo"</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oCbx <span style="color: #0000ff;">VAR</span> cItem <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Testing"</span>, <span style="color: #ff0000;">"this"</span>, <span style="color: #ff0000;">"ComboBox"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">110</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">when</span> cMode <> <span style="color: #ff0000;">"V"</span><br /><br /> oCbx:<span style="color: #000000;">oGet</span>:<span style="color: #000000;">SetFont</span><span style="color: #000000;">(</span> oFont <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> oCbx1 <span style="color: #0000ff;">VAR</span> cItem1 <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Testing"</span>, <span style="color: #ff0000;">"this"</span>, <span style="color: #ff0000;">"ComboBox"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">111</span> <span style="color: #0000ff;">OF</span> oDlg<br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">200</span> <span style="color: #0000ff;">OF</span> oDlg;<br /> <span style="color: #0000ff;">ACTION</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:1n8rmdaz]
EMG |
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST | Enrico
That worked .. never would have got that one without your help!!
Thanks
Rick Lipkin |
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST | You're welcome, my friend! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
EMG |
Combobox Ownerdraw with Icon from DLL Sample | hi,
here a Demo how to use Ownerdraw with Comboxbox
it also show how to access System Icon "on-fly" so it will look same as Windows OS
[img:181eo7ky]https://i.postimg.cc/NF66p0GD/Combobox-Demo-Ownerdraw.jpg[/img:181eo7ky]
[code=fw:181eo7ky]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"WCOLORS.CH"</span><br /><br />* <span style="color: #00D7D7;">#DEFINE</span> Use_Command <span style="color: #B900B9;">// PLEASE enable and make it work like OOP Result</span><br /><span style="color: #00D7D7;">#DEFINE</span> use_IconEx<br /><br /><span style="color: #00D7D7;">#define</span> DRIVE_UNKNOWN <span style="color: #000000;">0</span><br /><span style="color: #00D7D7;">#define</span> DRIVE_NO_ROOT_DIR <span style="color: #000000;">1</span><br /><span style="color: #00D7D7;">#define</span> DRIVE_REMOVABLE <span style="color: #000000;">2</span><br /><span style="color: #00D7D7;">#define</span> DRIVE_FIXED <span style="color: #000000;">3</span><br /><span style="color: #00D7D7;">#define</span> DRIVE_REMOTE <span style="color: #000000;">4</span><br /><span style="color: #00D7D7;">#define</span> DRIVE_CDROM <span style="color: #000000;">5</span><br /><span style="color: #00D7D7;">#define</span> DRIVE_RAMDISK <span style="color: #000000;">6</span><br /><br /><span style="color: #00D7D7;">#define</span> DT_LEFT 0x00000000<br /><span style="color: #00D7D7;">#define</span> DT_WORDBREAK 0x00000010<br /><span style="color: #00D7D7;">#define</span> DT_NOPREFIX 0x00000800<br /><span style="color: #00D7D7;">#define</span> DT_VCENTER <span style="color: #000000;">4</span><br /><span style="color: #00D7D7;">#define</span> DT_SINGLELINE <span style="color: #000000;">32</span><br /><span style="color: #00D7D7;">#define</span> DT_CENTER <span style="color: #000000;">1</span><br /><br /><span style="color: #00D7D7;">#define</span> DI_IMAGE 0x0002<br /><span style="color: #00D7D7;">#define</span> DI_NORMAL 0x0003<br /><br /><span style="color: #00D7D7;">#define</span> ODA_DRAWENTIRE 0x0001<br /><span style="color: #00D7D7;">#define</span> ODA_SELECT 0x0002<br /><span style="color: #00D7D7;">#define</span> ODA_FOCUS 0x0004<br /><br /><span style="color: #00D7D7;">#define</span> ODT_LISTBOX <span style="color: #000000;">2</span><br /><span style="color: #00D7D7;">#define</span> ODT_COMBOBOX <span style="color: #000000;">3</span><br /><br /><span style="color: #00D7D7;">#define</span> ODS_SELECTED 0x0001<br /><span style="color: #00D7D7;">#define</span> ODS_FOCUS 0x0010<br /><span style="color: #00D7D7;">#define</span> ODS_DEFAULT 0x0020<br /><br /><span style="color: #00C800;">STATIC</span> acItem, acType, acBitmaps, nFirstUSB<br /><span style="color: #00C800;">STATIC</span> BFcolor<br /><span style="color: #00C800;">STATIC</span> BGcolor<br /><br />*+--------------------------------------------------------------------<br />*+<br />*+ Procedure Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />*+<br />*+--------------------------------------------------------------------<br />*+<br />PROCEDURE Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> oMain, oFontDefault, oCombo<br /><span style="color: #00C800;">LOCAL</span> nFontSize := <span style="color: #000000;">20</span><br /><span style="color: #00C800;">LOCAL</span> cPath := ´C:\´<br /><br /> BFcolor := nRGB<span style="color: #000000;">(</span><span style="color: #000000;">0</span>,<span style="color: #000000;">255</span>,<span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// CLR_BLACK</span><br /> BGcolor := nRGB<span style="color: #000000;">(</span><span style="color: #000000;">0</span>,<span style="color: #000000;">0</span>,<span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// CLR_WHITE</span><br /><br /> GetAllDrive<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFontDefault <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>, - nFontSize<br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">FONT</span> oFontDefault<br />#IFDEF __HMG__<br /> END <span style="color: #0000ff;">FONT</span><br />#ENDIF<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oMain <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">400</span>, <span style="color: #000000;">300</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"FiveWin Combobox Ownerdraw Demo "</span> <span style="color: #0000ff;">COLOR</span> BFcolor, BGcolor<br /><br />#IFDEF Use_Command<br /> @ <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span> <span style="color: #0000ff;">COMBOBOX</span> oCombo <span style="color: #0000ff;">ITEMS</span> acItem <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">90</span>, <span style="color: #000000;">300</span> <span style="color: #0000ff;">COLOR</span> BFcolor, BGcolor <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFontDefault <span style="color: #0000ff;">BITMAPS</span> acBitmaps ;<br /> <span style="color: #0000ff;">ON</span> DRAWITEM <span style="color: #000000;">{</span> | a, b, c, d | DoMyComBo<span style="color: #000000;">(</span> a, b, c, d, @acItem, @acType, @acBitmaps, oCombo <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br />#ELSE<br /> oCombo := TComboBox<span style="color: #000000;">(</span><span style="color: #000000;">)</span> :<span style="color: #00C800;">new</span><span style="color: #000000;">(</span> <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span>,, acItem, <span style="color: #000000;">90</span>, <span style="color: #000000;">300</span>, oMain,,,, BFcolor, BGcolor, .T., oFontDefault,,,, .F., acBitmaps <span style="color: #000000;">)</span><br /> oCombo:<span style="color: #000000;">nDropWidth</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oCombo:<span style="color: #000000;">nItemHeight</span><span style="color: #000000;">(</span> <span style="color: #000000;">32</span> <span style="color: #000000;">)</span><br /> oCombo:<span style="color: #000000;">nSelectionHeight</span><span style="color: #000000;">(</span> <span style="color: #000000;">32</span> <span style="color: #000000;">)</span><br /> oCombo:<span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> oCombo:<span style="color: #000000;">lIncSearch</span> := .T.<br /> oCombo:<span style="color: #000000;">bKeyDown</span> := <span style="color: #00C800;">NIL</span><br /> oCombo:<span style="color: #000000;">bOwnerDraw</span> := <span style="color: #000000;">{</span> | a, b, c, d | DoMyComBo<span style="color: #000000;">(</span> a, b, c, d, @acItem, @acType, @acBitmaps, oCombo <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oCombo:<span style="color: #000000;">GetKeyChar</span><span style="color: #000000;">(</span> <span style="color: #0000ff;">ASC</span><span style="color: #000000;">(</span> <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span> cPath, <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br />#ENDIF<br /><br />#IFDEF __HMG__<br /> END <span style="color: #0000ff;">WINDOW</span><br />#ENDIF<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oMain <span style="color: #0000ff;">CENTER</span><br /><br /><span style="color: #00C800;">RETURN</span><br /><br />*+--------------------------------------------------------------------<br />*+<br />*+ <span style="color: #00C800;">Function</span> DoMyComBo<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />*+<br />*+ Called <span style="color: #0000ff;">from</span> <span style="color: #000000;">(</span> cbowner.prg <span style="color: #000000;">)</span> <span style="color: #000000;">2</span> - procedure main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />*+ <span style="color: #000000;">(</span> dualgrid.prg <span style="color: #000000;">)</span> <span style="color: #000000;">1</span> - <span style="color: #00C800;">class</span> texplorer<br />*+<br />*+--------------------------------------------------------------------<br />*+<br /><span style="color: #00C800;">FUNCTION</span> DoMyComBo<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> WinDir := GETENV<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Windir"</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> cPara := <span style="color: #ff0000;">""</span><br /><span style="color: #00C800;">LOCAL</span> cAlign := nOr<span style="color: #000000;">(</span> DT_LEFT, DT_NOPREFIX <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> nIcoHandle := <span style="color: #000000;">0</span><br /><span style="color: #00C800;">LOCAL</span> nSize := <span style="color: #000000;">32</span><br /><span style="color: #00C800;">LOCAL</span> ii, nCount, xPara<br /><span style="color: #00C800;">LOCAL</span> oSelf<br /><span style="color: #00C800;">LOCAL</span> nIdCtl<br /><span style="color: #00C800;">LOCAL</span> oStruc<br /><span style="color: #00C800;">LOCAL</span> nPointer<br /><span style="color: #00C800;">LOCAL</span> acItem, acType, cItemText, oObj<br /><span style="color: #00C800;">LOCAL</span> CtlType<br /><span style="color: #00C800;">LOCAL</span> CtlID<br /><span style="color: #00C800;">LOCAL</span> itemID<br /><span style="color: #00C800;">LOCAL</span> itemAction<br /><span style="color: #00C800;">LOCAL</span> itemState<br /><span style="color: #00C800;">LOCAL</span> hwndItem<br /><span style="color: #00C800;">LOCAL</span> hDC<br /><span style="color: #00C800;">LOCAL</span> aRect<br /><span style="color: #00C800;">LOCAL</span> nLeft<br /><span style="color: #00C800;">LOCAL</span> nTop<br /><span style="color: #00C800;">LOCAL</span> nRight<br /><span style="color: #00C800;">LOCAL</span> nBottom<br /><span style="color: #00C800;">LOCAL</span> itemData<br /><span style="color: #00C800;">LOCAL</span> cDLL<br /><span style="color: #00C800;">LOCAL</span> hModule<br /><span style="color: #00C800;">LOCAL</span> nResID<br /><span style="color: #00C800;">LOCAL</span> aBitmaps, hBitMap, acBitmaps<br /><span style="color: #00C800;">LOCAL</span> OldAt := - <span style="color: #000000;">1</span><br /><span style="color: #00C800;">LOCAL</span> BrushHiBack := CreateSolidBrush<span style="color: #000000;">(</span> BFcolor <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> BrushSysColor := CreateSolidBrush<span style="color: #000000;">(</span> BGcolor <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> aGrad := <span style="color: #000000;">{</span> ;<br /> <span style="color: #000000;">{</span> .<span style="color: #000000;">5</span>, BFcolor, BGcolor <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> .<span style="color: #000000;">6</span>, BGcolor, BFcolor <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> .<span style="color: #000000;">1</span>, BFcolor, BGcolor <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">}</span><br /><br /> nCount := PCOUNT<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> ii := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> nCount<br /> xPara := PValue<span style="color: #000000;">(</span> ii <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">1</span><br /> oSelf := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">2</span><br /> nIdCtl := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">3</span><br /> oStruc := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">4</span><br /> nPointer := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">5</span><br /> acItem := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">6</span><br /> acType := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">7</span><br /> acBitmaps := xPara<br /> <span style="color: #00C800;">CASE</span> ii = <span style="color: #000000;">8</span><br /> oObj := xPara<br /> <span style="color: #00C800;">IF</span> !EMPTY<span style="color: #000000;">(</span> oObj <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> VALTYPE<span style="color: #000000;">(</span> oObj <span style="color: #000000;">)</span> = <span style="color: #ff0000;">"O"</span><br /> OldAt := oObj:<span style="color: #000000;">nAt</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDCASE</span><br /> <span style="color: #00C800;">NEXT</span><br /><br /> CtlType := oStruc:<span style="color: #000000;">CtlType</span><br /> CtlID := oStruc:<span style="color: #000000;">CtlID</span><br /> itemID := oStruc:<span style="color: #000000;">itemID</span><br /> itemAction := oStruc:<span style="color: #000000;">itemAction</span><br /> itemState := oStruc:<span style="color: #000000;">itemState</span><br /> hwndItem := oStruc:<span style="color: #000000;">hwndItem</span><br /> hDC := oStruc:<span style="color: #000000;">hDC</span><br /> aRect := oStruc:<span style="color: #000000;">aRect</span><br /> itemData := oStruc:<span style="color: #000000;">itemData</span><br /><br /> nTop := aRect<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span><br /> nLeft := aRect<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span><br /> nBottom := aRect<span style="color: #000000;">[</span> <span style="color: #000000;">3</span> <span style="color: #000000;">]</span><br /> nRight := aRect<span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span><br /><br /> <span style="color: #00C800;">IF</span> CtlType = ODT_COMBOBOX .OR. CtlType = ODT_LISTBOX <span style="color: #B900B9;">// .AND. CtlID =</span><br /><br /> SetBkMode<span style="color: #000000;">(</span> hDC, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// TRANSPARENT =1 OPAQUE =2</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">CASE</span> itemAction = ODA_SELECT <br /> FillRect<span style="color: #000000;">(</span> hDC, aRect, BrushSysColor <span style="color: #000000;">)</span><br /> SetTextColor<span style="color: #000000;">(</span> hDC, BFcolor <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">CASE</span> itemAction = ODA_DRAWENTIRE<br /> <span style="color: #00C800;">IF</span> OldAt = itemID + <span style="color: #000000;">1</span> .AND. oObj:<span style="color: #000000;">IsOpen</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> OldAt = - <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">IF</span> BGColor = <span style="color: #000000;">256</span> * <span style="color: #000000;">256</span> * <span style="color: #000000;">256</span> - <span style="color: #000000;">1</span> <span style="color: #B900B9;">// 16777215</span><br /> <span style="color: #B900B9;">// Msginfo("white")</span><br /> FillRect<span style="color: #000000;">(</span> hDC, aRect, COLOR_MENUHILIGHT + <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> SetTextColor<span style="color: #000000;">(</span> hDC, GetSysColor<span style="color: #000000;">(</span> COLOR_MENU <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /> GradientFill<span style="color: #000000;">(</span> hDC, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">3</span> <span style="color: #000000;">]</span> - <span style="color: #000000;">1</span>, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>, aGrad, .t. <span style="color: #000000;">)</span><br /> SetTextColor<span style="color: #000000;">(</span> hDC, BFcolor <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ELSE</span><br /> FillRect<span style="color: #000000;">(</span> hDC, aRect, BrushSysColor <span style="color: #000000;">)</span><br /> SetTextColor<span style="color: #000000;">(</span> hDC, BFcolor <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">CASE</span> itemAction = ODA_FOCUS<br /> <span style="color: #00C800;">IF</span> BGColor = <span style="color: #000000;">256</span> * <span style="color: #000000;">256</span> * <span style="color: #000000;">256</span> - <span style="color: #000000;">1</span> <span style="color: #B900B9;">// 16777215</span><br /> FillRect<span style="color: #000000;">(</span> hDC, aRect, COLOR_MENUHILIGHT + <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> SetTextColor<span style="color: #000000;">(</span> hDC, GetSysColor<span style="color: #000000;">(</span> COLOR_MENU <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /> GradientFill<span style="color: #000000;">(</span> hDC, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">3</span> <span style="color: #000000;">]</span> - <span style="color: #000000;">1</span>, aRect<span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>, aGrad, .t. <span style="color: #000000;">)</span><br /> SetTextColor<span style="color: #000000;">(</span> hDC, BFcolor <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">ENDCASE</span><br /><br />#IFDEF use_IconEx<br /><br /> cDLL := WinDir + <span style="color: #ff0000;">"<span style="color: #000000;">\S</span>ystem32<span style="color: #000000;">\i</span>mageres.dll"</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_UNKNOWN<br /> nResID := <span style="color: #000000;">75</span><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_NO_ROOT_DIR<br /> nResID := <span style="color: #000000;">32</span><br /><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_REMOVABLE<br /> <span style="color: #00C800;">IF</span> <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span> acItem<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> $ <span style="color: #ff0000;">"AB"</span><br /> nResID := <span style="color: #000000;">23</span><br /> <span style="color: #00C800;">ELSE</span><br /> cDLL := WinDir + <span style="color: #ff0000;">"<span style="color: #000000;">\S</span>ystem32<span style="color: #000000;">\D</span>DORes.dll"</span><br /> nResID := <span style="color: #000000;">2389</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_FIXED<br /> <span style="color: #00C800;">IF</span> <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span> acItem<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> = <span style="color: #ff0000;">"C:"</span><br /> nResID := <span style="color: #000000;">36</span><br /> <span style="color: #00C800;">ELSE</span><br /> nResID := <span style="color: #000000;">32</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_REMOTE<br /> nResID := <span style="color: #000000;">33</span><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_CDROM<br /> nResID := <span style="color: #000000;">30</span><br /> <span style="color: #00C800;">CASE</span> acType<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> = DRIVE_RAMDISK<br /> nResID := <span style="color: #000000;">34</span><br /><br /> <span style="color: #00C800;">ENDCASE</span><br /><br /> hModule := GetModuleHandle<span style="color: #000000;">(</span> cDLL <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> hModule == <span style="color: #000000;">0</span><br /> hModule := LoadLibrary<span style="color: #000000;">(</span> cDLL <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> nIcoHandle := LOADIMAGERESICON<span style="color: #000000;">(</span> hModule, nResID, <span style="color: #000000;">32</span> <span style="color: #000000;">)</span><br /><br /> DrawIconEx<span style="color: #000000;">(</span> hDC, ;<br /> nTop - <span style="color: #000000;">4</span>, ;<br /> nLeft, ;<br /> nIcoHandle, ;<br /> nSize, ;<br /> nSize, ;<br /> <span style="color: #000000;">0</span>, ; <span style="color: #B900B9;">// _In_ UINT istepIfAniCur,</span><br /> <span style="color: #000000;">0</span>, ; <span style="color: #B900B9;">// _In_opt_ HBRUSH hbrFlickerFreeDraw,</span><br /> nOr<span style="color: #000000;">(</span> DI_NORMAL <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// _In_ UINT diFlags</span><br /><br /> DestroyIcon<span style="color: #000000;">(</span> nIcoHandle <span style="color: #000000;">)</span><br /> FreeLibrary<span style="color: #000000;">(</span> hModule <span style="color: #000000;">)</span><br /><br />#ELSE<br /><br /> aBitmaps := FW_ReadImage<span style="color: #000000;">(</span> <span style="color: #00C800;">nil</span>, acBitmaps<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, <span style="color: #000000;">{</span> nSize - <span style="color: #000000;">2</span>, nSize - <span style="color: #000000;">2</span> <span style="color: #000000;">}</span>, .F. <span style="color: #000000;">)</span><br /> hBitMap := aBitmaps<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span><br /><br /> DrawBitmap<span style="color: #000000;">(</span> hDC, hBitMap, nTop + <span style="color: #000000;">3</span>, nLeft, nSize - <span style="color: #000000;">3</span>, nSize - <span style="color: #000000;">6</span> <span style="color: #000000;">)</span><br /><br /> PalBmpFree<span style="color: #000000;">(</span> aBitmaps <span style="color: #000000;">)</span><br /> DeleteObject<span style="color: #000000;">(</span> hBitMap <span style="color: #000000;">)</span><br /><br />#ENDIF<br /><br /> nLeft += <span style="color: #000000;">32</span> + <span style="color: #000000;">4</span><br /><br /> cItemText := acItem<span style="color: #000000;">[</span> itemID + <span style="color: #000000;">1</span> <span style="color: #000000;">]</span><br /><br /> DrawText<span style="color: #000000;">(</span> hDC, ;<br /> cItemText, ;<br /> <span style="color: #000000;">{</span> nTop + <span style="color: #000000;">4</span>, nLeft, nBottom, nRight <span style="color: #000000;">}</span>, ;<br /> cAlign <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> DeleteObject<span style="color: #000000;">(</span> BrushHiBack <span style="color: #000000;">)</span><br /> DeleteObject<span style="color: #000000;">(</span> BrushSysColor <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> .T.<br /><br />*+--------------------------------------------------------------------<br />*+<br />*+ <span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> GetAllDrive<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />*+<br />*+ Called <span style="color: #0000ff;">from</span> <span style="color: #000000;">(</span> cbowner.prg <span style="color: #000000;">)</span> <span style="color: #000000;">1</span> - procedure main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />*+<br />*+--------------------------------------------------------------------<br />*+<br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> GetAllDrive<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">LOCAL</span> aDrives := aDrives<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> ii, cDrive, nType, cLabel, cBitmap<br /><br /> acItem := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> acBitmaps := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> acType := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> nFirstUSB := <span style="color: #000000;">0</span><br /><br /> <span style="color: #00C800;">FOR</span> ii := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span> aDrives <span style="color: #000000;">)</span><br /> cDrive := <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span> aDrives<span style="color: #000000;">[</span> ii <span style="color: #000000;">]</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> nType := GETDRIVETYPE<span style="color: #000000;">(</span> cDrive + <span style="color: #ff0000;">":"</span> <span style="color: #000000;">)</span><br /> cLabel := VOLUMENAME<span style="color: #000000;">(</span> cDrive + <span style="color: #ff0000;">":<span style="color: #000000;">\"</span> )<br /> DO CASE<br /> CASE nType = DRIVE_UNKNOWN<br /> cBitmap := "</span>MYUNKNOWN16<span style="color: #ff0000;">"<br /><br /> CASE nType = DRIVE_NO_ROOT_DIR<br /> cBitmap := "</span>MYFIXDRIVE16<span style="color: #ff0000;">"<br /><br /> CASE nType = DRIVE_REMOVABLE<br /> IF cDrive $ "</span>AB<span style="color: #ff0000;">"<br /> cBitmap := "</span>MYFLOPPY16<span style="color: #ff0000;">" // Floppy<br /> ELSE<br /> cBitmap := "</span>MYUSBSTICK16<span style="color: #ff0000;">" // DRIVE_REMOVABLE<br /> IF EMPTY( nFirstUSB )<br /> nFirstUSB := ii<br /> ENDIF<br /> ENDIF<br /><br /> CASE nType = DRIVE_FIXED<br /> IF cDrive = "</span>C<span style="color: #ff0000;">"<br /> cBitmap := "</span>MYSYSDRIVE16<span style="color: #ff0000;">"<br /> ELSE<br /> cBitmap := "</span>MYFIXDRIVE16<span style="color: #ff0000;">"<br /> ENDIF<br /><br /> CASE nType = DRIVE_REMOTE<br /> cBitmap := "</span>MYNETDRIVE16<span style="color: #ff0000;">"<br /><br /> CASE nType = DRIVE_CDROM<br /> cBitmap := "</span>MYCDROM16<span style="color: #ff0000;">"<br /><br /> CASE nType = DRIVE_RAMDISK<br /> cBitmap := "</span>MYRAMDISK16<span style="color: #ff0000;">"<br /><br /> OTHERWISE<br /> cBitmap := "</span>MYUNKNOWN16<span style="color: #ff0000;">"<br /> ENDCASE<br /><br /> AADD( acItem, cDrive + "</span>:<span style="color: #ff0000;">" + SPACE( 3 ) + cLabel )<br /> AADD( acBitmaps, cBitmap )<br /> AADD( acType, nType )<br /> NEXT<br /><br />RETURN aDrives<br /><br />*+ EOF: CBOWNER.PRG</span></div>[/code:181eo7ky]
i have try to use Command Syntax but fail <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
can someone please revise my Command Syntax to get same Result like OOP |
Combobox Picture | Dear friends,
in this combobox
REDEFINE COMBOBOX oCliente VAR cCliente ID 105 OF oDlg ITEMS aItems
oCliente:lIncSearch = .T.
oCliente:oGet:bKeyChar = { | nKey | oCLiente:KeyChar( nKey ) }
oCliente:oGet:cPicture = "@!"
It seems that picture does not work
I digit "Antonio" and does not appear "ANTONIO"
any hints
marco |
Combobox Picture | oCliente:oGet:bKeyChar = { | nKey | oCLiente:KeyChar( ASC(UPPER(CHR(nKey )))) }
king regards
marco |
Combobox Problem | Hello,
When the user presses a character to move to the item within a COMBOBOX, it does not work. I updated to version 7.01. |
Combobox Problem | I noticed that too.
To solve it for the moment, I linked in the COMBOBOX.PRG from FW 2.7.
Now it's working fine.
Regards,
Michel |
Combobox Problem | Hi Michel,
Thank you. Can you send me the 2.7 PRG as I over wrote my version with the update. |
Combobox Problem | No problem.
Here it is.
Just copy and paste and you've got is.
Michel
*edited by admin* |
Combobox Problem | [quote="cdmmaui":15fd64lt]When the user presses a character to move to the item within a COMBOBOX, it does not work. I updated to version 7.01.[/quote:15fd64lt]
Yes, confirm!
for solve, replace the method KeyChar with this:
[code:15fd64lt]//----------------------------------------------------------------------------//
METHOD KeyChar( nKey, nFlags ) CLASS TComboBox
local nNewAT := 0, nOldAT := ::nAT, uItem
do case
case nKey = 32 // VK_DELETE (DO NOT WORK!)
::cSearchKey := ""
nNewAt := 1
uItem := ::aItems[nNewAt]
case nKey = VK_BACK
::cSearchKey := Left( ::cSearchKey, Len( ::cSearchKey ) - 1 )
case nKey = 190
nKey := 0
::cSearchKey += "."
otherwise
::cSearchKey += Upper( Chr( nKey ) )
endcase
if Empty( uItem )
if nNewAt == 0
nNewAt := AScan( ::aItems, {|x| Upper(x) = ::cSearchKey } )
IF nNewAt > 0 .AND. Len( ::aItems ) <= nNewAt
uItem := ::aItems[ nNewAt ]
ENDIF
uItem := ::aItems[ IIF( nNewAt > 0, nNewAt, Max( ::nAT, 1 ) ) ]
else
uItem := ::aItems[ Max( nNewAt, 1) ]
endif
endif
::Set( uItem )
if ::bChange != nil .and. ( nNewAT != nOldAt .and. nNewAt != 0 )
Eval( ::bChange, Self, ::varGet() )
endif
if nKey == VK_RETURN
return ::oWnd:GoNextCtrl( ::hWnd )
endif
return 0 // Must be 0 - We don't want API default behavior.[/code:15fd64lt] |
Combobox Problem | FWH 7.01 implements incremental search in comboboxes, thats why if you press two chars, one after another, if searches for the item that starts with both chars (implemented by Ugo).
Ugo, thanks for the fix <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
Combobox Question | Antonio -
Using the following code in my clipper/Fivewin apps, the "get" next to the dropdown arrow automatically shows the first element of aYr. The xHarbour/Fivewin version shows a blank get.
LOCAL oDlg, oYr, cYr, aYr := {}
aYr := GetYrs()
REDEFINE COMBOBOX oYr ;
VAR cYr ;
ITEMS aYr ;
ID 101 of oDlg
I can get it to show the first element if I do cYr := aYr[1], but I have a lot of code to change to make it the same as the clipper versions. Is this a limitation of xHarbour/Fivewin? Can I modify tcombobox to be like clipper?
Regards,
Charles |
Combobox Question | Hi Charles:
Try this:
LOCAL oDlg, oYr, cYr, aYr := {}
aYr := GetYrs()
cYr := aYr[ 1 ]
REDEFINE COMBOBOX oYr ;
VAR cYr ;
ITEMS aYr ;
ID 101 of oDlg
Regards
Manuel Mercado |
Combobox Question | Charles,
>Using the following code in my clipper/Fivewin apps, the "get" next to the dropdown arrow automatically shows the first element of aYr.
This is actually isn't the best behavior. How can you show if the user hasn't made a choice? Also, if I remember correctly, it SHOWS the first choice, but unless the user actually clicks on the combobox it SAVES a blank. Thus the user thinks the combobox is defaulting to the first choice (without any click), but it isn't.
>The xHarbour/Fivewin version shows a blank get.
This is better. Unless the user makes a selection, then the field remains empty. I find it is often better to allow users to leave fields blank rather than to default them to a value (or to to force the user to enter something when they don't know it). It is easier to detect an empy field (later) than to detect incorrect data that has been saved just due to design issues.
I will admit there are situations where a default value may be better such as when that value is the most common choice. This helps the user. But it has to be the most common choice by all users.
Regards,
James |
Combobox Question | Hi James -
Thanks for your response. You're right about the best programming form, etc. However, in my case, a lot of my combos are years and/or months. in the case of years, the current year is shown in the get and the dropdown goes back in time eventually to the first year there are data. Also, where there is a combo where a month needs to be chosen, it is convenient to have "January" in the get.
I guess my issue is that I have a lot of these where there is no instruction or label on the dialog because clipper/fivewin shows the cYr in the get with the value of aYr[1] and the user can imediately see what he/she has to do when he sees two combos that show "2007" and "January" in them.
I will have to either modify the the dialogs with a label for each combo or give a value to the cYr in the code. I guess the best way is to start doing the cYr := aYr[1] with all new things and and somehow modify TCOMBOBOX to be clipper compatible and rebuild all of my existing exe's with it.
Any ideas will be helpful.
Regards,
Charles |
Combobox Question | Charles,
You can easily modify Class TComboBox source code to make it work the way you want:
[code:u40zt12v]
METHOD Default() CLASS TComboBox
...
if Empty( cStart ) // instead of: if cStart == nil
...
[/code:u40zt12v] |
Combobox Question | Thanks, Antonio. This will do the job for me.
Regards,
Charles |
Combobox Size | I've noticed this for a long time ... never found an answer to it.
If I have a series of controls defined in an .rc file, all with a vertical size of 10, if one is a combobox, dropdown, then on the actual dialog it will be a larger then the other edit fields. It appears to be 12 to 14 high rather then 10 like the other items.
Any thoughts on this ? |
Combobox Size | The height of a combobox is tied to the font used, as far as I know.
EMG |
Combobox Size | Tim,
I agree with Enrico.
Also, some comboboxes contain a Get so you may be able to change oCmbo:oGet:nHeight. I haven't tried this.
James |
Combobox Size | It just looks bad. The same font is used for edits and comboboxes !
In the code, we use:
REDEFINE COMBOBOX abcITEMS aCol ID 2211 OF oDvm STYLE CBS_DROPDOWN MESSAGE "Enter the color of this unit" UPDATE
And the RC is:
CONTROL "", 2211, "ComboBox", WS_BORDER|CBS_DROPDOWN|WS_VSCROLL|WS_TABSTOP, 368,41,110, 264
We have to use 264 to allow enough vertical length for the data to display. However all GET edit boxes have a height of 10.
It would be nice to have them uniform. |
Combobox Size | Tim,
Did you try:
oCmbo:oGet:nHeight := 10
oCmbo:oGet:refresh()
Or you may have to do:
oCmbo:oGet:setSize( oCmbo:oGet:nWidth, 10, .t. )
James |
Combobox Size | Actually I found that setting the height of my edit boxes on the dialog is probably easiest. I have them set to 13 and they now match the combo box.
I'm manually realligning all the dialogs ... so it actually cleans up nicely and makes the screens easier to read. I think my clients will be pleased. |
Combobox Size | That's the height I use too.
EMG |
Combobox TMySql v/s Dbf | Fivewiners
favor llevo rato con este tema.. toy comenzado a migrar y utilizar TMsql pero no logro algo basico como este combobox...
aqui como lo hago en mi actual DBF y como intento con TmSql
CRE0 COMBOBOX CON LOS DATOS DE UNA DBF
::oCliente := TRed():Use( ::cRuta + "MAANALIS.Dbf", ::cRuta + "analisis.Cdx" )
::oTipo_Cte := TRed():Use( ::cRuta + "TIPOCTES.Dbf", ::cRuta + "tipo_cte.Cdx" )
::aCte := Array( 02 )
::aCte[01] := {}
::aCte[02] := {}
::oTipo_Cte:Eval( { || AAdd( ::aCte[01], ::oTipo_Cte:descripcion ),;
AAdd( ::aCte[02], ::oTipo_Cte:COD_TIPO )})
::vCmb[01] := ::aCte[01][max( 1,aScan( ::aCte[02], { |a|a = ::oCliente:COD_TIPO } ) ) ]
***RESULTADO ME MUESTRA EL COMBO CON LA DESCRIPCION DEL TIPO DE CLIENTE FUNCIONA PERFECTO
DEFINE Dialog oDlg Resource "DL_102"
Redefine ComboBox ::oCmb[01] VAR ::vCmb[01] Id 107 Of oDlg Items ::aCte[01]
Activate Dialog ::oDlg
LO MISMO COMBOBOX CON TMSQL
***ABRO LAS TABLAS
::oCliente := ::oMain:oCon:Query( "SELECT * FROM MAANALIS" )
::oTipo_Cte := ::oMain:oCon:Query( "SELECT * FROM TIPOCTES" )
*** CREO UN ARREGLO CON LOS DATOS DEL TIPO DE CLIENTES PARA LUEGO RELACIONARLO CON CADA CLIENTE
::aCte := Array( 02 )
::aCte[01] := {}
::aCte[02] := {}
WHILE !::oTipo_Cte :eof()
AAdd( ::aCte[01], ::oTipo_Cte:descripcion )
AAdd( ::aCte[02], ::oTipo_Cte:COD_TIPO )
::oTipo_Cte:skip()
ENDDO
*** ASI INTENTO RELACIONAR LAS TABLAS, para mostrar el la seleccion en el combobox
::vCmb[01] := ::aCte[01][max( 1,aScan( ::aCte[02], { |a|a = ::oClientes("COD_TIPO") } ) ) ]
***LUEGO ABRO EL COMBOBOX EN UN DIALOGO, SOLO MUESTRA EL PRIMER COD_TIPO Y NO CAMBIA EN CASO QUE EL CLIENTE TENGA OTRO COD_TIPO
DEFINE Dialog oDlg Resource "DL_102"
Redefine ComboBox ::oCmb[01] VAR ::vCmb[01] Id 107 Of oDlg1 Items ::aCte[01]
Activate Dialog ::oDlg
GRACIAS POR SU TIEMPO... |
Combobox TMySql v/s Dbf | Y si abris la consulta ordenada?
***ABRO LAS TABLAS
::oCliente := ::oMain:oCon:Query( "SELECT * FROM MAANALIS ORDER BY ...." ) // con el orden que tiene analisis.cdx
::oTipo_Cte := ::oMain:oCon:Query( "SELECT * FROM TIPOCTES ORDER BY ..." ) // con el orden que tiene tipo_cte.cdx
Así los datos estarian ordenados igual que en tu ejemplo de DBF.
Solo para probar... |
Combobox and VK_UP VK_DOWN keys SOLUCIONADO | Hi, all.
Is there any way to avoid it hitting the bChange combobox when using the UP, DOWN keys?
What I want to do is use these keys to scroll through the items of combobox, and that this run the code bChange until the ENTER key is pressed.
How to do this?
Greetings.
[url=http://imageshack.us/photo/my-images/546/b7pm.png/:3mpuvjvy][img:3mpuvjvy]http://img546.imageshack.us/img546/4070/b7pm.png[/img:3mpuvjvy][/url:3mpuvjvy]
Uploaded with [url=http://imageshack.us:3mpuvjvy]ImageShack.us[/url:3mpuvjvy]
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=6&t=26880#p149211">viewtopic.php?f=6&t=26880#p149211</a><!-- l --> |
Combobox and database | Antonio,
Is this possible to use combobox control with database alias (one or more character fields) where items are read from database ?
Thanks
Pawel |
Combobox and database | Pawel,
In FWH there is a Class TDbCombo where items are read from a DBF.
If you want it, we can email it to you, so you can test it with FWPPC. It should work |
Combobox and database | Antonio,
Yes, please.
Thanks
Pawel |
Combobox and database | Already sent <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
Combobox and database | No tenho a classe TDbCombo, dá para enviar um exemplo,, como utilizar essa classe com uma tabela .dbf
Obrigado
Sérgio Gonçalves |
Combobox and database | Sergio,
Here you have it,
dbcombo.prg
[code=fw:tm10goab]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">/*<br />File Name: DBCombo.prg<br />Author: Elliott Whitticar, <!-- e --><a href="mailto:71221.1413@Compuserve.com">71221.1413@Compuserve.com</a><!-- e --><br />Created: 4/25/96<br />Description: Database-aware ComboBox class. Can show one field and return another.<br />Revision: Changes made by James Bott, Intellitech. <!-- e --><a href="mailto:jbott@compuserve.com">jbott@compuserve.com</a><!-- e --><br /> 11/2/2003 Changed manifest constants to also be 32bit compatible.<br /> Initiate(): Changed to call TControl:initiate()<br /> New() & Redefine() : Changed to return self (were incorrectly returning nil).<br /> Refill() - Now adds blank record to all lists. (Was incorrectly showing first<br /> item when variable was empty.)<br /> 5/21/2004 Added keyChar method with incremental search. Space key resets search.<br /> Of course, data has to be in sort order.<br /> 6/14/2005 Changed to default cAlias to alias().<br /> Refill() Changed name to Fill(). Added new method Refill().<br /> Had to do this to properly reinitialize the control when refilled.<br /> 6/15/2005 Updated the Default() method to fix some bugs (dropdown not working<br /> after Refill(). Changed dbcombo.ch to allow specifying fields with<br /> or without guotes. E.G. ITEMFIELD city or ITEMFIELD "city"<br /> 7/21/2005 Fixed bug. When using autocomplete was returning numeric instead of char.<br /> 2/23/2006 Fixed several bugs when passing arrays from the new or redefine methods.<br /> 2/24/2006 LostFocus() Modified so aItems can be numeric.<br /> 3/31/2006 KeyChar() Fixed bug when both bChanged and lUpdate were used.<br /> 04/3/2006 Refill() Fixed typo.<br /> 7/02/2006 Update() Added new method. Slightly different than Refill(). - Antonio Linares<br /><br />//----------------------------------------------------------------------------//<br />Notes<br /><br />The TDBCombo class provides a combo-box which displays one field from<br />a table (such as DeptName) and returns another (such as DeptID). Table can<br />be indexed and/or filtered, just set them before calling DBCombo.<br /><br />To use dbcombo as a resource, define the resource as a combobox. Make sure the ComboBox<br />is not configured to sort aList, or DBCombo will not return the matching element of aItems.<br />Then REDEFINE the combobox control as a DBCOMBO.<br /><br />aList must be character. aItems can be character or numeric.<br /><br /><br />*/</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Constant.ch"</span><br /><br />#ifndef __CLIPPER__<br /> <span style="color: #00D7D7;">#define</span> COMBO_BASE <span style="color: #000000;">320</span><br />#else<br /> <span style="color: #00D7D7;">#define</span> COMBO_BASE WM_USER<br />#endif<br /><span style="color: #00D7D7;">#define</span> CB_ADDSTRING <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">3</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_DELETESTRING <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">4</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_GETCURSEL <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">7</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_INSERTSTRING <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">10</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_RESETCONTENT <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">11</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_FINDSTRING <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">12</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_SETCURSEL <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">14</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_SHOWDROPDOWN <span style="color: #000000;">(</span> COMBO_BASE + <span style="color: #000000;">15</span> <span style="color: #000000;">)</span><br /><span style="color: #00D7D7;">#define</span> CB_ERR <span style="color: #000000;">-1</span><br /><br /><span style="color: #00D7D7;">#define</span> COLOR_WINDOW <span style="color: #000000;">5</span><br /><span style="color: #00D7D7;">#define</span> COLOR_WINDOWTEXT <span style="color: #000000;">8</span><br /><br /><span style="color: #00D7D7;">#define</span> MB_ICONEXCLAMATION <span style="color: #000000;">48</span> <span style="color: #B900B9;">// 0x0030</span><br /><br /><span style="color: #00D7D7;">#define</span> GWL_STYLE <span style="color: #000000;">-16</span><br /><br />#ifdef __XPP__<br /><span style="color: #00D7D7;">#define</span> <span style="color: #00C800;">Super</span> ::<span style="color: #000000;">TComboBox</span><br />#endif<br /><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><br /><span style="color: #00C800;">CLASS</span> TDBCombo <span style="color: #0000ff;">FROM</span> TComboBox<br /><br /> <span style="color: #00C800;">DATA</span> cAlias <span style="color: #B900B9;">// Workarea alias for fields to display.</span><br /> <span style="color: #00C800;">DATA</span> cFldList <span style="color: #B900B9;">// Field to display in the ComboBox.</span><br /> <span style="color: #00C800;">DATA</span> cFldItem <span style="color: #B900B9;">// Field to return in the bound variable.</span><br /> <span style="color: #00C800;">DATA</span> aList <span style="color: #B900B9;">// Array of display items corresponding to aItems.</span><br /> <span style="color: #B900B9;">// May be specified in the constructor or read from</span><br /> <span style="color: #B900B9;">// cAlias->cFldList</span><br /> <span style="color: #00C800;">DATA</span> cSearchKey <span style="color: #B900B9;">// Holds current search key for incremental search.</span><br /> <span style="color: #00C800;">DATA</span> lSound <span style="color: #0000ff;">init</span> .T. <span style="color: #B900B9;">// Use sound</span><br /><br /> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span> nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId, ;<br /> bChange, bValid, nClrText, nClrBack, lPixel, oFont, ;<br /> cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, ;<br /> cAlias, cFldItem, cFldList, aList <span style="color: #000000;">)</span> CONSTRUCTOR<br /><br /> <span style="color: #00C800;">METHOD</span> <span style="color: #0000ff;">ReDefine</span><span style="color: #000000;">(</span> nId, bSetGet, aItems, oWnd, nHelpId, bValid, ;<br /> bChange, nClrText, nClrBack, cMsg, lUpdate, ;<br /> bWhen, acBitmaps, bDrawItem, ;<br /> cAlias, cFldItem, cFldList, aList <span style="color: #000000;">)</span> CONSTRUCTOR<br /><br /> <span style="color: #00C800;">METHOD</span> Add<span style="color: #000000;">(</span> cItem, nAt, cList <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">Default</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> Del<span style="color: #000000;">(</span> nAt <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> DrawItem<span style="color: #000000;">(</span> nIdCtl, nPStruct <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> Fill<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Fill aItems, aList from database. Used internally only.</span><br /><br /> <span style="color: #00C800;">METHOD</span> Initiate<span style="color: #000000;">(</span> hDlg <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> Insert<span style="color: #000000;">(</span> cItem, nAt, cList <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> KeyChar<span style="color: #000000;">(</span> nKey, nFlags <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Incremental search</span><br /><br /> <span style="color: #00C800;">METHOD</span> ListGet<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Returns the selected element of ::aList</span><br /><br /> <span style="color: #00C800;">METHOD</span> LostFocus<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> Modify<span style="color: #000000;">(</span> cItem, nAt, cList <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> Refill<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Refill aItems and aList from cFldItem and cFldList</span><br /><br /> <span style="color: #00C800;">METHOD</span> SetItems<span style="color: #000000;">(</span> aItems, aList <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">METHOD</span> <span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span> nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId, ;<br /> bChange, bValid, nClrFore, nClrBack, lPixel, oFont, ;<br /> cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, ;<br /> cAlias, cFldItem, cFldList, aList <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">DEFAULT</span> cAlias := <span style="color: #0000ff;">alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> cFldList := <span style="color: #ff0000;">""</span>, ;<br /> cFldItem := <span style="color: #ff0000;">""</span>, ;<br /> aList := <span style="color: #000000;">{</span><span style="color: #000000;">}</span>,;<br /> aItems:= <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> ::<span style="color: #000000;">aList</span> := aList<br /> ::<span style="color: #000000;">aItems</span> := aItems<br /> ::<span style="color: #000000;">cAlias</span> := cAlias<br /> ::<span style="color: #000000;">cFldList</span> := cFldList<br /> ::<span style="color: #000000;">cFldItem</span> := cFldItem<br /> ::<span style="color: #000000;">cSearchKey</span>:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">if</span> empty<span style="color: #000000;">(</span>::<span style="color: #000000;">aItems</span><span style="color: #000000;">)</span> .and. empty<span style="color: #000000;">(</span>::<span style="color: #000000;">aList</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Fill</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">cAlias</span>:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">Super</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> nRow, nCol, bSetGet, ::<span style="color: #000000;">aItems</span>, nWidth, nHeight, oWnd, nHelpId, ;<br /> bChange, bValid, nClrFore, nClrBack, lPixel, oFont, ;<br /> cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">self</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #0000ff;">ReDefine</span><span style="color: #000000;">(</span> nId, bSetGet, aItems, oWnd, nHelpId, bValid, ;<br /> bChange, nClrFore, nClrBack, cMsg, lUpdate, ;<br /> bWhen, acBitmaps, bDrawItem, ;<br /> cAlias, cFldItem, cFldList, aList <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">DEFAULT</span> cAlias := <span style="color: #0000ff;">alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ;<br /> cFldList := <span style="color: #ff0000;">""</span>, ;<br /> cFldItem := <span style="color: #ff0000;">""</span>, ;<br /> aList := <span style="color: #000000;">{</span><span style="color: #000000;">}</span>,;<br /> aItems:= <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> ::<span style="color: #000000;">aList</span> := aList<br /> ::<span style="color: #000000;">aItems</span> := aItems<br /> ::<span style="color: #000000;">cAlias</span> := cAlias<br /> ::<span style="color: #000000;">cFldList</span> := cFldList<br /> ::<span style="color: #000000;">cFldItem</span> := cFldItem<br /> ::<span style="color: #000000;">cSearchKey</span>:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">if</span> empty<span style="color: #000000;">(</span>::<span style="color: #000000;">aItems</span><span style="color: #000000;">)</span> .and. empty<span style="color: #000000;">(</span>::<span style="color: #000000;">aList</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Fill</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">cAlias</span>:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">Super</span>:<span style="color: #0000ff;">ReDefine</span><span style="color: #000000;">(</span> nId, bSetGet, ::<span style="color: #000000;">aItems</span>, oWnd, nHelpId, bValid, ;<br /> bChange, nClrFore, nClrBack, cMsg, lUpdate, ;<br /> bWhen, acBitmaps, bDrawItem <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">self</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Add<span style="color: #000000;">(</span> cItem, nAt, cList <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /> <span style="color: #B900B9;">// Note that compared to the parent class, we've added an arg at the end.</span><br /><br /> <span style="color: #00C800;">DEFAULT</span> nAt := <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">DEFAULT</span> cList := cItem<br /><br /> <span style="color: #00C800;">if</span> nAt == <span style="color: #000000;">0</span><br /> AAdd<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, cItem <span style="color: #000000;">)</span><br /> AAdd<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, cList <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ASize<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span> <span style="color: #000000;">)</span> + <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> ASize<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span> <span style="color: #000000;">)</span> + <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> AIns<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, nAt <span style="color: #000000;">)</span><br /> AIns<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, nAt <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> = cItem<br /> ::<span style="color: #000000;">aList</span><span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> = cList<br /> <span style="color: #00C800;">endif</span><br /><br /> ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_ADDSTRING, nAt, cList <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">Default</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">local</span> cStart := Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> .and. ::<span style="color: #000000;">nStyle</span> == CBS_DROPDOWNLIST<br /> ::<span style="color: #000000;">nStyle</span> := GetWindowLong<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span>, GWL_STYLE <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">if</span> cStart == <span style="color: #00C800;">nil</span><br /> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span>, <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span> <span style="color: #000000;">)</span> > <span style="color: #000000;">0</span>, ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> cStart = <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span> <span style="color: #000000;">)</span> > <span style="color: #000000;">0</span>, ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> AEval<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, <span style="color: #000000;">{</span> | cList, nAt | ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_ADDSTRING, nAt, cList <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> ValType<span style="color: #000000;">(</span> cStart <span style="color: #000000;">)</span> != <span style="color: #ff0000;">"N"</span><br /> ::<span style="color: #000000;">nAt</span> = AScan<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, <span style="color: #000000;">{</span> | cList | Upper<span style="color: #000000;">(</span> AllTrim<span style="color: #000000;">(</span> cList <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> == ;<br /> Upper<span style="color: #000000;">(</span> AllTrim<span style="color: #000000;">(</span> cStart <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">nAt</span> = cStart<br /> <span style="color: #00C800;">endif</span><br /><br /> ::<span style="color: #000000;">nAt</span> = <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ::<span style="color: #000000;">nAt</span> > <span style="color: #000000;">0</span>, ::<span style="color: #000000;">nAt</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> cStart == <span style="color: #00C800;">nil</span><br /> ::<span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span> ::<span style="color: #000000;">nAt</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">Set</span><span style="color: #000000;">(</span> cStart <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Del<span style="color: #000000;">(</span> nAt <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">DEFAULT</span> nAt := <span style="color: #000000;">0</span><br /><br /> <span style="color: #00C800;">if</span> nAt != <span style="color: #000000;">0</span><br /> ADel<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, nAt <span style="color: #000000;">)</span><br /> ADel<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, nAt <span style="color: #000000;">)</span><br /> ASize<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span> <span style="color: #000000;">)</span> - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> ASize<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span> <span style="color: #000000;">)</span> - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_DELETESTRING, nAt - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> DrawItem<span style="color: #000000;">(</span> nIdCtl, nPStruct <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /><span style="color: #00C800;">return</span> LbxDrawItem<span style="color: #000000;">(</span> nPStruct, ::<span style="color: #000000;">aBitmaps</span>, ::<span style="color: #000000;">aList</span>, ::<span style="color: #000000;">nBmpWidth</span>, ::<span style="color: #000000;">bDrawItem</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Initiate<span style="color: #000000;">(</span> hDlg <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDbCombo<br /><br /> ::<span style="color: #000000;">TControl</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Initiate</span><span style="color: #000000;">(</span> hDlg <span style="color: #000000;">)</span><br /> ::<span style="color: #00C800;">Default</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Insert<span style="color: #000000;">(</span> cItem, nAt, cList <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">DEFAULT</span> nAt := <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">DEFAULT</span> cList := cItem<br /><br /> <span style="color: #00C800;">if</span> nAt != <span style="color: #000000;">0</span><br /> ASize<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span> <span style="color: #000000;">)</span> + <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> ASize<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, Len<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span> <span style="color: #000000;">)</span> + <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> AIns<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, nAt <span style="color: #000000;">)</span><br /> AIns<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, nAt <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> = cItem<br /> ::<span style="color: #000000;">aList</span><span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> = cList<br /> ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_INSERTSTRING, nAt - <span style="color: #000000;">1</span>, cList <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> KeyChar<span style="color: #000000;">(</span> nKey, nFlags<span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">local</span> nNewAT := <span style="color: #000000;">0</span>, nOldAT:=::<span style="color: #000000;">nAT</span><br /><br /> <span style="color: #B900B9;">// Incremental search</span><br /> <span style="color: #00C800;">if</span> nKey = <span style="color: #000000;">32</span> <span style="color: #B900B9;">// space resets the search</span><br /> ::<span style="color: #000000;">cSearchKey</span> := <span style="color: #ff0000;">""</span><br /> ::<span style="color: #000000;">Set</span><span style="color: #000000;">(</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ValType<span style="color: #000000;">(</span> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> == <span style="color: #ff0000;">"N"</span>, <span style="color: #000000;">1</span>, ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> nKey = VK_BACK<br /> ::<span style="color: #000000;">cSearchKey</span> := <span style="color: #0000ff;">left</span><span style="color: #000000;">(</span>::<span style="color: #000000;">cSearchKey</span>,Len<span style="color: #000000;">(</span>::<span style="color: #000000;">cSearchKey</span><span style="color: #000000;">)</span><span style="color: #000000;">-1</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">cSearchKey</span> += upper<span style="color: #000000;">(</span>chr<span style="color: #000000;">(</span>nKey<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> nNewAT := ascan<span style="color: #000000;">(</span>::<span style="color: #000000;">aList</span>, <span style="color: #000000;">{</span>|x| upper<span style="color: #000000;">(</span>x<span style="color: #000000;">)</span> = ::<span style="color: #000000;">cSearchKey</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> nNewAt != nOldAt .and. nNewAT != <span style="color: #000000;">0</span> <span style="color: #B900B9;">// If found and changed</span><br /><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">lSound</span><br /> tone<span style="color: #000000;">(</span><span style="color: #000000;">60</span>,.<span style="color: #000000;">3</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// sound if searchkey found</span><br /> <span style="color: #00C800;">endif</span><br /><br /> ::<span style="color: #000000;">Set</span><span style="color: #000000;">(</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ValType<span style="color: #000000;">(</span> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> == <span style="color: #ff0000;">"N"</span>, nNewAt, ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> nNewAt <span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">bChange</span> != <span style="color: #00C800;">nil</span><br /><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">oGet</span> != <span style="color: #00C800;">nil</span> <span style="color: #B900B9;">// Always not nil for dropdown</span><br /> ::<span style="color: #000000;">oGet</span>:<span style="color: #000000;">VarPut</span><span style="color: #000000;">(</span> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// udate variable before calling bChange</span><br /> ::<span style="color: #000000;">oGet</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bChange</span>, <span style="color: #00C800;">Self</span>, ::<span style="color: #000000;">varGet</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">return</span> <span style="color: #000000;">0</span><br /><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">cSearchKey</span> := <span style="color: #0000ff;">left</span><span style="color: #000000;">(</span>::<span style="color: #000000;">cSearchKey</span>,Len<span style="color: #000000;">(</span>::<span style="color: #000000;">cSearchKey</span><span style="color: #000000;">)</span><span style="color: #000000;">-1</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">Super</span>:<span style="color: #000000;">KeyChar</span><span style="color: #000000;">(</span>nKey, nFlags<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">0</span> <span style="color: #B900B9;">// Must be 0 - We don't want API default behavior.</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> ListGet<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">local</span> cRet, nAt := ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_GETCURSEL <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> nAt != CB_ERR<br /> ::<span style="color: #000000;">nAt</span> = nAt + <span style="color: #000000;">1</span><br /> cRet := ::<span style="color: #000000;">aList</span><span style="color: #000000;">[</span> ::<span style="color: #000000;">nAt</span> <span style="color: #000000;">]</span><br /> <span style="color: #00C800;">else</span><br /> cRet := GetWindowText<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> cRet<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> LostFocus<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">local</span> nAt := ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_GETCURSEL <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> nAt != CB_ERR<br /> ::<span style="color: #000000;">nAt</span> = nAt + <span style="color: #000000;">1</span><br /> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span>, ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> ::<span style="color: #000000;">nAt</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bSetGet</span>, GetWindowText<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> ::<span style="color: #000000;">cSearchKey</span>:=<span style="color: #ff0000;">""</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Modify<span style="color: #000000;">(</span> cItem, nAt, cList <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">DEFAULT</span> nAt := <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">DEFAULT</span> cList := cItem<br /><br /> <span style="color: #00C800;">if</span> nAt != <span style="color: #000000;">0</span><br /> ::<span style="color: #000000;">aItems</span><span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> = cItem<br /> ::<span style="color: #000000;">aList</span><span style="color: #000000;">[</span> nAt <span style="color: #000000;">]</span> = cList<br /> ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_DELETESTRING, nAt - <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">SendMsg</span><span style="color: #000000;">(</span> CB_INSERTSTRING, nAt - <span style="color: #000000;">1</span>, cList <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Fill<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #B900B9;">// Refill aItems and aList from cAlias->cFldItem and cAlias->cFldList</span><br /><br /> <span style="color: #00C800;">LOCAL</span> nOldRecNo<br /> <span style="color: #00C800;">LOCAL</span> nItem, nList<br /><br /> <span style="color: #00C800;">IF</span> ::<span style="color: #000000;">cAlias</span> == <span style="color: #ff0000;">""</span><br /> <span style="color: #B900B9;">// There's no workarea defined, so do nothing.</span><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> END <span style="color: #00C800;">IF</span><br /><br /> <span style="color: #00C800;">IF</span> <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">(</span> ::<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span> == <span style="color: #000000;">0</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"TDBCombo:Fill() - Alias '"</span> + ::<span style="color: #000000;">cAlias</span> + <span style="color: #ff0000;">"' does not exist."</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> END <span style="color: #00C800;">IF</span><br /><br /> ::<span style="color: #000000;">aItems</span> := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> ::<span style="color: #000000;">aList</span> := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">IF</span> <span style="color: #000000;">(</span>nItem := <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>FIELDPOS<span style="color: #000000;">(</span> ::<span style="color: #000000;">cFldItem</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> > <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">IF</span> <span style="color: #000000;">(</span>nList := <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>FIELDPOS<span style="color: #000000;">(</span> ::<span style="color: #000000;">cFldList</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> > <span style="color: #000000;">0</span><br /><br /> nOldRecNo := <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>RECNO<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Make first record blank (so you can have an empty field)</span><br /> <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>DBGOBOTTOM<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>DBSKIP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> AADD<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>FIELDGET<span style="color: #000000;">(</span> nItem <span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> AADD<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>FIELDGET<span style="color: #000000;">(</span> nList <span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>DBGOTOP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> ! <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>EOF<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> AADD<span style="color: #000000;">(</span> ::<span style="color: #000000;">aItems</span>, <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>FIELDGET<span style="color: #000000;">(</span> nItem <span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> AADD<span style="color: #000000;">(</span> ::<span style="color: #000000;">aList</span>, <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>FIELDGET<span style="color: #000000;">(</span> nList <span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>DBSKIP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /><br /> <span style="color: #000000;">(</span>::<span style="color: #000000;">cAlias</span><span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>DBGOTO<span style="color: #000000;">(</span> nOldRecNo <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ELSE</span><br /> msgAlert<span style="color: #000000;">(</span><span style="color: #ff0000;">"TDBCombo:Fill() - Fieldname "</span>+::<span style="color: #000000;">cFldList</span>+<span style="color: #ff0000;">" not found."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> Refill<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /> ::<span style="color: #000000;">Reset</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Fill</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #00C800;">Default</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #0000ff;">Change</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> SetItems<span style="color: #000000;">(</span> aItems, aList <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDbCombo<br /><br /> <span style="color: #00C800;">IF</span> LEN<span style="color: #000000;">(</span>aItems<span style="color: #000000;">)</span> != LEN<span style="color: #000000;">(</span>aList<span style="color: #000000;">)</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"TDBCombo:SetItems(): aItems and aList must be same length."</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ELSE</span><br /> ::<span style="color: #000000;">cAlias</span>:= <span style="color: #ff0000;">""</span><br /> ::<span style="color: #000000;">Reset</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">aItems</span> := aItems<br /> ::<span style="color: #000000;">aList</span> := aList<br /> ::<span style="color: #00C800;">Default</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #0000ff;">Change</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END <span style="color: #00C800;">IF</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDBCombo<br /><br /> <span style="color: #00C800;">local</span> bChange:= ::<span style="color: #000000;">bChange</span><br /><br /> ::<span style="color: #000000;">bChange</span>:= <span style="color: #00C800;">Nil</span><br /> ::<span style="color: #000000;">Reset</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Fill</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #00C800;">Default</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">bChange</span> := bChange<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:tm10goab] |
Combobox and database | pederias me enviar um exemplo como utilizar esta classe
ex. tabela1.dbf
Obrigado |
Combobox and database | DbCombo.ch is also required:
DbCombo.ch
[code=fw:2kynq2h8]<div class="fw" id="{CB}" style="font-family: monospace;"><br />*********************************************************************<br />* File <span style="color: #0000ff;">Name</span>: <span style="color: #000000;">DBCombo</span>.ch<br />* Author: <span style="color: #000000;">Elliott</span> Whitticar<br />* Created: <span style="color: #000000;">04</span>/<span style="color: #000000;">23</span>/<span style="color: #000000;">96</span><br />* Description: <span style="color: #000000;">Preprocessor</span> directives <span style="color: #00C800;">for</span> TDBCombo <span style="color: #00C800;">class</span>.<br />*********************************************************************<br />#ifndef _DBCOMBO_CH<br /><span style="color: #00D7D7;">#define</span> _DBCOMBO_CH<br /><br /><span style="color: #B900B9;">/*----------------------------------------------------------------------------//<br />!short: DBCOMBO */</span><br /><br />#xcommand @ <nRow>, <nCol> DBCOMBO <span style="color: #000000;">[</span> <oCbx> <span style="color: #0000ff;">VAR</span> <span style="color: #000000;">]</span> <cVar> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ITEMS</span> <aItems> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">SIZE</span> <nWidth>, <nHeight> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <dlg:<span style="color: #0000ff;">OF</span>,<span style="color: #0000ff;">WINDOW</span>,DIALOG> <oWnd> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <help:<span style="color: #000000;">HELPID</span>, <span style="color: #0000ff;">HELP</span> ID> <nHelpId> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <uChange> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">VALID</span> <uValid> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <color: <span style="color: #0000ff;">COLOR</span>,COLORS> <nClrText> <span style="color: #000000;">[</span>,<nClrBack><span style="color: #000000;">]</span> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <pixel: <span style="color: #000000;">PIXEL</span>> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">FONT</span> <oFont> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <update: <span style="color: #000000;">UPDATE</span>> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">MESSAGE</span> <cMsg> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">WHEN</span> <uWhen> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <design: <span style="color: #000000;">DESIGN</span>> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">BITMAPS</span> <acBitmaps> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ON</span> DRAWITEM <uBmpSelect> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ALIAS</span> <cAlias> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> ITEMFIELD <cFldItem> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> LISTFIELD <cFldList> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <list: <span style="color: #000000;">LIST</span>, PROMPTS> <aList> <span style="color: #000000;">]</span> ;<br /> => ;<br /> <span style="color: #000000;">[</span> <oCbx> := <span style="color: #000000;">]</span> TDBCombo<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <nRow>, <nCol>, bSETGET<span style="color: #000000;">(</span><cVar><span style="color: #000000;">)</span>,;<br /> <aItems>, <nWidth>, <nHeight>, <oWnd>, <nHelpId>,;<br /> <span style="color: #000000;">[</span><span style="color: #000000;">{</span>|Self|<uChange><span style="color: #000000;">}</span><span style="color: #000000;">]</span>, <<span style="color: #000000;">{</span>uValid<span style="color: #000000;">}</span>>, <nClrText>, <nClrBack>,;<br /> <.<span style="color: #0000ff;">pixel</span>.>, <oFont>, <cMsg>, <.<span style="color: #0000ff;">update</span>.>, <<span style="color: #000000;">{</span>uWhen<span style="color: #000000;">}</span>>,;<br /> <.design.>, <acBitmaps>, <span style="color: #000000;">[</span><span style="color: #000000;">{</span>|nItem|<uBmpSelect><span style="color: #000000;">}</span><span style="color: #000000;">]</span>, ;<br /> <cAlias>, <<span style="color: #000000;">(</span>cFldItem<span style="color: #000000;">)</span>>, <<span style="color: #000000;">(</span>cFldList<span style="color: #000000;">)</span>>, <aList> <span style="color: #000000;">)</span><br /><br />#xcommand <span style="color: #0000ff;">REDEFINE</span> DBCOMBO <span style="color: #000000;">[</span> <oCbx> <span style="color: #0000ff;">VAR</span> <span style="color: #000000;">]</span> <cVar> ;<br /> <span style="color: #000000;">[</span> <items: <span style="color: #000000;">ITEMS</span>> <aItems> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ID</span> <nId> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <dlg:<span style="color: #0000ff;">OF</span>,<span style="color: #0000ff;">WINDOW</span>,DIALOG> <oWnd> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <help:<span style="color: #000000;">HELPID</span>, <span style="color: #0000ff;">HELP</span> ID> <nHelpId> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <uChange> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">VALID</span> <uValid> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <color: <span style="color: #0000ff;">COLOR</span>,COLORS> <nClrText> <span style="color: #000000;">[</span>,<nClrBack><span style="color: #000000;">]</span> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <update: <span style="color: #000000;">UPDATE</span>> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">MESSAGE</span> <cMsg> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">WHEN</span> <uWhen> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">BITMAPS</span> <acBitmaps> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ON</span> DRAWITEM <uBmpSelect> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ALIAS</span> <cAlias> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> ITEMFIELD <cFldItem> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> LISTFIELD <cFldList> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <list: <span style="color: #000000;">LIST</span>, PROMPTS> <aList> <span style="color: #000000;">]</span> ;<br /> => ;<br /> <span style="color: #000000;">[</span> <oCbx> := <span style="color: #000000;">]</span> TDBCombo<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #0000ff;">ReDefine</span><span style="color: #000000;">(</span> <nId>, bSETGET<span style="color: #000000;">(</span><cVar><span style="color: #000000;">)</span>,;<br /> <aItems>, <oWnd>, <nHelpId>, <<span style="color: #000000;">{</span>uValid<span style="color: #000000;">}</span>>, <span style="color: #000000;">[</span><span style="color: #000000;">{</span>|Self|<uChange><span style="color: #000000;">}</span><span style="color: #000000;">]</span>,;<br /> <nClrText>, <nClrBack>, <cMsg>, <.<span style="color: #0000ff;">update</span>.>, <<span style="color: #000000;">{</span>uWhen<span style="color: #000000;">}</span>>,;<br /> <acBitmaps>, <span style="color: #000000;">[</span><span style="color: #000000;">{</span>|nItem|<uBmpSelect><span style="color: #000000;">}</span><span style="color: #000000;">]</span>, ;<br /> <cAlias>, <<span style="color: #000000;">(</span>cFldItem<span style="color: #000000;">)</span>>, <<span style="color: #000000;">(</span>cFldList<span style="color: #000000;">)</span>>, <aList> <span style="color: #000000;">)</span><br /><br />#endif<br /> </div>[/code:2kynq2h8] |
Combobox and database | This is an example for FWH, and it should work for FWPPC too:
test.prg
[code=fw:10d7v9xl]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">/*<br />Program : DBC1.PRG<br />Purpose : Test DBCombo<br />Notes :<br />*/</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"dbcombo.ch"</span><br /><br /><br /><span style="color: #00C800;">function</span> main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oDlg, oDBC1, oDBC2, cVar, oCust, cStateID:=<span style="color: #ff0000;">" "</span>, oBtn, cState:=<span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">local</span> cDept:= space<span style="color: #000000;">(</span><span style="color: #000000;">3</span><span style="color: #000000;">)</span>, oStates, aItems, aList<br /> field <span style="color: #0000ff;">NAME</span><br /><br /> <span style="color: #00C800;">if</span> file<span style="color: #000000;">(</span><span style="color: #ff0000;">"states.dbf"</span><span style="color: #000000;">)</span><br /> use states<br /> <span style="color: #0000ff;">index</span> <span style="color: #0000ff;">on</span> upper<span style="color: #000000;">(</span><span style="color: #0000ff;">NAME</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">to</span> temp<br /> database oStates<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"File states.dbf not found."</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #0000ff;">define</span> <span style="color: #0000ff;">dialog</span> oDlg<br /><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">30</span> dbcombo oDBC1 <span style="color: #0000ff;">var</span> cStateID <span style="color: #0000ff;">of</span> oDlg;<br /> <span style="color: #0000ff;">alias</span> oStates:<span style="color: #000000;">cAlias</span>;<br /> <span style="color: #0000ff;">size</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">200</span> <span style="color: #0000ff;">pixel</span>;<br /> itemfield <span style="color: #ff0000;">"CODE"</span> ;<br /> listfield <span style="color: #ff0000;">"NAME"</span>;<br /> <span style="color: #0000ff;">update</span>;<br /><br /> aList:= <span style="color: #000000;">{</span><span style="color: #ff0000;">"Accounting"</span>,<span style="color: #ff0000;">"HR"</span>,<span style="color: #ff0000;">"Marketing"</span>,<span style="color: #ff0000;">"Production"</span>,<span style="color: #ff0000;">"Research"</span>,<span style="color: #ff0000;">"Shipping"</span>,<span style="color: #ff0000;">"Sales"</span><span style="color: #000000;">}</span><br /> aItems:= <span style="color: #000000;">{</span><span style="color: #ff0000;">"100"</span>,<span style="color: #ff0000;">"200"</span>,<span style="color: #ff0000;">"400"</span>,<span style="color: #ff0000;">"300"</span>,<span style="color: #ff0000;">"600"</span>,<span style="color: #ff0000;">"500"</span>,<span style="color: #ff0000;">"700"</span><span style="color: #000000;">}</span><br /><br /> @ <span style="color: #000000;">30</span>,<span style="color: #000000;">30</span> DBCOMBO oDBC2 <span style="color: #0000ff;">VAR</span> cDept;<br /> <span style="color: #0000ff;">items</span> aItems;<br /> <span style="color: #0000ff;">size</span> <span style="color: #000000;">100</span>,<span style="color: #000000;">200</span> <span style="color: #0000ff;">pixel</span>;<br /> list aList;<br /> <span style="color: #0000ff;">of</span> oDlg;<br /> <span style="color: #0000ff;">update</span><br /><br /><br /> @ <span style="color: #000000;">50</span>, <span style="color: #000000;">50</span> <span style="color: #0000ff;">button</span> oBtn <span style="color: #0000ff;">prompt</span> <span style="color: #ff0000;">"Selected"</span>;<br /> <span style="color: #0000ff;">of</span> oDlg <span style="color: #0000ff;">pixel</span> ;<br /> <span style="color: #0000ff;">action</span> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"cStateId: "</span> +cStateID +CRLF+<span style="color: #ff0000;">"DeptNo: "</span>+cDept,<span style="color: #ff0000;">"Selected"</span> <span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">default</span><br /><br /> <span style="color: #0000ff;">activate</span> <span style="color: #0000ff;">dialog</span> oDlg <span style="color: #0000ff;">center</span>;<br /><br /> ferase<span style="color: #000000;">(</span><span style="color: #ff0000;">"temp.ntx"</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">// EOF</span><br /> </div>[/code:10d7v9xl] |
Combobox and database | Dá o seguinte erro:
error LNK2001: unresolved external symbol HB_FUN_TDBCOMBO
Sérgio |
Combobox and multiarray | Hi all,
another question about combobox.
Is there a way to use a combobox to display only the second element of a multiarray ?
For example, I have a multi array like this:
aItems:={}
aadd(aItems,{"01","Marc"})
aadd(aItems,{"02","Frank"})
aadd(aItems,{"03","Paul"})
and I would like to display into the combo just the second element, so "Marc","Frank","Paul".
At the moment I solved making a new class but I would like to make this using the standard combobox class if possibile.
Any ideas ? Thanks in advance. |
Combobox and multiarray | @ r, c COMBOBOX oCbx ........ ITEMS ArrTranspose( aItems )[ 2 ] ....... |
Combobox and multiarray | Hi nageswaragunupudi,
thanks for the suggest. It runs well used as command line, but I'm unable to create a command "COMBOLIST" that automatically use this function with multidimensional array taking always the 2nd element.
Where I'm wrong ?
#xcommand REDEFINE COMBOLIST [ <oCbx> VAR ] <cVar> ;
[ <items: PROMPTS, ITEMS> <aItems> ] ;
[ ID <nId> ] ;
[ <dlg:OF,WINDOW,DIALOG> <oWnd> ] ;
[ <help:HELPID, HELP ID> <nHelpId> ] ;
[ ON CHANGE <uChange> ] ;
[ VALID <uValid> ] ;
[ <color: COLOR,COLORS> <nClrText> [,<nClrBack>] ] ;
[ <update: UPDATE> ] ;
[ MESSAGE <cMsg> ] ;
[ WHEN <uWhen> ] ;
[ BITMAPS <acBitmaps> ] ;
[ ON DRAWITEM <uBmpSelect> ] ;
[ STYLE <nStyle> ] ;
[ <pict: PICT, PICTURE> <cPicture> ];
[ ON EDIT CHANGE <uEChange> ] ;
=> ;
[ <oCbx> := ] TComboBox():ReDefine( <nId>, bSETGET(<cVar>),;
ArrTranspose(<aItems>)[2], <oWnd>, <nHelpId>, <{uValid}>, [{|Self|<uChange>}],;
<nClrText>, <nClrBack>, <cMsg>, <.update.>, <{uWhen}>,;
<acBitmaps>, [{|nItem|<uBmpSelect>}], <nStyle>, <cPicture>,;
[<{uEChange}>] )
Thanks in advance |
Combobox and multiarray | ArrTranspose(<aItems>)\[2\] |
Combobox and multiarray | Thank you. |
Combobox and multimensional arrays | Hi,
is there any way to manage a multidimensional array in a combobox ?
I have a two dimension array like this:
aArray:=array(0,2)
aadd(aArray,{01,"Primo"})
aadd(aArray,{02,"Secondo"})
aadd(aArray,{03,"Terzo"})
and I would like to display in the combobox only the second element (First,second, third).
Any ideas ?
Marco Turco |
Combobox and multimensional arrays | Marco,
You may review samples\TestArr2.prg. Its a browse, not a combobox, but it uses a multidimensional array |
Combobox and scroll mouse SOLVED | Hello friends.
Why if a combobox has focus and we do scroll with the mouse in any other control of a dialog, change combobox items?. And if we do several scrolls up and down, always away from the combobox, the items themselves are constantly changing?
This is the correct behavior of the combobox, or ... Right?
I thank if any of you confirm to me this behavior.
Greetings.
PS: I use combobox.prg original, and also I have tried with one that posted the Maestro Antonio Linares, recently. |
Combobox and scroll mouse SOLVED | Francisco,
[quote="FranciscoA":3ujkc7r9]This is the correct behavior of the combobox, or ... Right?[/quote:3ujkc7r9]
Yes, it's the correct behavior. Please check other applications, even MS ones.
EMG |
Combobox and scroll mouse SOLVED | Enrico, thanks for answering.
Indeed, he had already seen the behavior in MS programs like Excel / Word, but these do not change the combobox's Get value, only move their items, when you uses the mouse's scroll away from the combobox. |
Combobox and scroll mouse SOLVED | Francisco,
If your combobox is using ON CHANGE then it will be evaluated everytime the selection changes.
As I commented you, use oComboBox:bCloseUp instead of ON CHANGE on those cases |
Combobox and scroll mouse SOLVED | Antonio,
Excuse me, I forgot actualize this post.
Best regards. |
Combobox bajo fhw7.01 no retorna el indice | Buenos dias,
Sr. Antonio
En la version de fhw701 el combobox no me retorna el indice e sin el contenido, vea el ejemplo:
nOp := { "meu", "seu", "deles" }
Si seleciono "meu" en el combobox, el retorno es "meu", deberia me retornar 1 como las versões anteriores, que pasa? como resolvo isto?
Gracias de antemano, |
Combobox bajo fhw7.01 no retorna el indice | Buen día para todos...
Que tal amigo laugusto, por casualidad probaste el ejemplo TestComb.prg que está en Samples?. |
Combobox bajo fhw7.01 no retorna el indice | Amigo alguna vez a mi me paso algo igual. Y el problema radicaba en que en PELLESC, existe una propiedad llamada SORT o algo asi. Intenta desabilitando esa opción.
Saludos
Espero te sirva. |
Combobox bajo fhw7.01 no retorna el indice | Luiz Augusto,
Puedes mostrar el código en donde creas el combobox ? gracias |
Combobox bajo fhw7.01 no retorna el indice | Buenas,
Gracias por me contestar Antonio, mi código es com segue:
[code:2gh2hszx]
// Tipo de Cabelo
TPCABT := { "A - Natural ", "B - Seco ", "C - Grosso ", "D - c/Química ",;
"E - Resistente", "F - Liso ", "G - Etnico ", "H - c/Queda ",;
"I - Fino ", "J - Médio ", "K - Ondulado " }
REDEFINE COMBOBOX oTFI_TPCAB VAR aFic[13] ITEMS TPCABT ID 74 OF oFld:aDialogs[01] STYLE CBS_DROPDOWN
oTFI_TPCAB:bGotFocus := { |Self| Self:Open() }
oTFI_TPCAB:bKeyDown := { |nKey| IF( nKey = VK_RETURN, oTFI_TPCABO:SetFocus(), ) }
na linea abajo, me causa el problema
Replace FI_TPCAB With Alltrim( Str( aFic[13] ))
FI_TPCAB es tipo caracter. e aFic[13] deberia ser numerico
[/code:2gh2hszx]
Gracias de Antemano, |
Combobox bajo fhw7.01 no retorna el indice | Buenas,
Antonio Castro, antes de atualizarme a fwh701, el combobox me retornava el indice del array;
Leandro Alfonso, no uso pellesc e sin el workshop;
Antonio Linhares, intentei compilar el combobox.prg de source\classes del fwh2.6 junto com meu projeto, e esta funcionando perfecto, no se o que passa, poderia revisar el combobox de las proximas versões?
Saludos, Regards, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.