Set Initial Focus Color

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Set Initial Focus Color

Post by Red2 »

I have what I trust is a very simple question about a Browse of a .DBF on a form.
I want the the Browse's very first (topmost) row to have and show focus. So, in the form's OnInit I issue the following:

Code: Select all

DBSelectArea( "MyItems" )
MyItems->( dbGoTop() )
// Then:
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
// The top row now has focus. 
Fine so far. However the selected (first) row's background color is an undesirable a very light grey.
But now whenever the user selects a row then that row clearly shows its focus
by its dark blue BACKGROUND color.

My Question:
I want that first row (with focus) to be initialized showing with the dark blue background color.
What command(s) can I use to force this dark blue background color?

Thank you for you kind assistance.

Red2
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: Set Initial Focus Color

Post by SALINETAS24 »

Red2 wrote: Mon Oct 26, 2020 3:47 pm I have what I trust is a very simple question about a Browse of a .DBF on a form.
I want the the Browse's very first (topmost) row to have and show focus. So, in the form's OnInit I issue the following:

Code: Select all

DBSelectArea( "MyItems" )
MyItems->( dbGoTop() )
// Then:
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
// The top row now has focus. 
Fine so far. However the selected (first) row's background color is an undesirable a very light grey.
But now whenever the user selects a row then that row clearly shows its focus
by its dark blue BACKGROUND color.

My Question:
I want that first row (with focus) to be initialized showing with the dark blue background color.
What command(s) can I use to force this dark blue background color?

Thank you for you kind assistance.

Red2

Code: Select all

SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
DataBrowse.BrowseItems.setfocus
Saludos
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Set Initial Focus Color

Post by Red2 »

Hi SALINETAS24,

Gracias por su amable respuesta. Agregué la línea que sugirió como sugirió.
Desafortunadamente, el formulario no se compila. Crea:
C: \ HMG-Official \ DataBrowse_OnInit.PRG (69) Error E0030 Error de sintaxis "error de sintaxis en '.'"

Luego probé la siguiente sintaxis:

Code: Select all

SetProperty ("DataBrowse", "BrowseItems", "SetFocus")
Si bien se compilará, esto no ayuda con mi problema de fondo azul oscuro.

Cualquier sugerencia adicional sería realmente apreciada.

English ==============================================
Thank your for your kind response. I added the line you suggested as you suggested.
Unfortunately the form does not compile. It creates:
C:\HMG-Official\DataBrowse_OnInit.PRG(69) Error E0030 Syntax error "syntax error at '.'"

I then tried the following syntax:

Code: Select all

SetProperty( "DataBrowse", "BrowseItems", "SetFocus" )
While it will compile this does not to help with my dark blue background problem.

Any further suggestions would really be appreciated.

Thanks again
Red2
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: Set Initial Focus Color

Post by SALINETAS24 »

Hola Red, estaría bien que mandases algo más de código, por ver donde y como tienes defino del DATABROWSE.
A mi la instrucción que te pase me funciona correctamente, en un GRID eso si.
Un saludo.
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Set Initial Focus Color

Post by AUGE_OHR »

hi Red,

SetFocus is NOT a Property, it is a Method ;)

Code: Select all

      Domethod( cForm, cGrid, "SetFocus" )
have fun
Jimmy
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Set Initial Focus Color

Post by Red2 »

Hi SALINETAS24,

Gracias (otra vez). Como mencioné, simplemente estoy examinando un .DBF en una TAB en un FORM.
Este formulario fue creado usando el IDE de HMG. No hay GRID aquí.

Claro que puede, aquí está el código de definición BROWSE (no GRID).

Code: Select all

DEFINE BROWSE BrowseItems
    ROW    52
    COL    22
    WIDTH  950
    HEIGHT 388
    VALUE 0
    WIDTHS { 200, 150, 100, 160, 74, 67, 170 }
    HEADERS {"Mfg. Name", "Type", "Size / Dim.", "Model", "Item Len.", "OAL", "Serial Number"}
    WORKAREA My_Items
    FIELDS {"My_Items->MFG_NAME", "My_Items->TYPE", "My_Items->SIZEDIM", "My_Items->MODEL", "My_Items->ITEM_LEN", "My_Items->OAL", "My_Items->SERIAL_NBR"}
    FONTNAME "Arial"
    FONTSIZE 9
    TOOLTIP ""
    ONCHANGE Nil
    ONGOTFOCUS OnPageSelection( "My_Items" )
    ONLOSTFOCUS Nil
    FONTBOLD .F.
    FONTITALIC .F.
    FONTUNDERLINE .F.
    FONTSTRIKEOUT .F.
    ONDBLCLICK DataBrowse_BrowseItems_OnDblClick()
    ALLOWEDIT .F.
    ALLOWAPPEND .F.
    ONHEADCLICK Nil
    ALLOWDELETE .F.
    HELPID Nil
    VALID Nil
    VALIDMESSAGES Nil
    LOCK .F.
    VSCROLLBAR .T.
    DYNAMICBACKCOLOR { bkItems, bkItemType, bkItems, bkItems, bkItems, bkItems, bkItems }
    DYNAMICFORECOLOR Nil
    INPUTMASK Nil
    FORMAT Nil
    WHEN Nil
    INPUTITEMS Nil
    DISPLAYITEMS Nil
    BACKCOLOR NIL
    FONTCOLOR NIL
    IMAGE Nil
    JUSTIFY Nil
    NOLINES .F.
    READONLYFIELDS Nil
    HEADERIMAGES Nil
END BROWSE
Cualquier ayuda es muy apreciada.

ENGLISH =================================
Thank you (once again). As I mentioned I am simply Browsing a .DBF in a TAB on a FORM.
This form was created using HMG's IDE. No GRID here.

Sure can, here is the BROWSE (not GRID) definition code. (SEE ABOVE)

Any help is greatly appreciated.

Red2
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Set Initial Focus Color

Post by Red2 »

Thank you Jimmy,

Of course you are correct, it is a Method.

I have tried putting

Code: Select all

DoMethod( "DataBrowse", "BrowseItems", "SetFocus" )
both before and after:
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
In both cases my BROWSE does not initialize with the row in FOCUS having dark blue BACKCOLOR.

It does not seem that this should be that hard in Harbour. Ideas anyone?

Again, thanks to all!
Red2
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Set Initial Focus Color

Post by AUGE_OHR »

hi,

did you have

Code: Select all

SET BROWSESYNC ON
i do "setFocus" just before ACTIVATE
have fun
Jimmy
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Set Initial Focus Color

Post by Red2 »

Hi Jimmy,

Thank you very much. Yes, in my Main.PRG (SET BROWSESYNC ON) exists.
When:

Code: Select all

DoMethod( "DataBrowse", "BrowseItems", "SetFocus" )
// Comes immediately before
activate window DataBrowse
there is still no change to the BACKCOLOR of the row in focus in that BROWSE.
QUESTION: Is that what you were suggesting regarding "just before ACTIVATE"?

I am grateful for your kind help. What am I missing here?
Kind regards,
Red2
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Set Initial Focus Color

Post by AUGE_OHR »

hi,

Browse have "Keyword"

Code: Select all

VALUE <nValue> ] 
so you can use Recno() at Create and must not use SetProperty()
have fun
Jimmy
Post Reply