Monday, February 16, 2015

Chrome inside VFP Form

Update February 18, 2015:

This is getting interesting.  I suddenly thought maybe Chrome allows parameters to be passed and indeed there are, tons of it.   Here are the switches:

http://peter.sh/experiments/chromium-command-line-switches/

As for forcing Chrome to open on a new window instead of the existing one as a tab, it is --new-window

I also updated the sample below to know whether the operation is successful or not so it won't accidentally open any other active window aside from our target.

Later:

As  for my problem to get rid of Chrome's internal titlebar, the trick came out to be very easy.   All we need to do is move the chrome up from within our form that its own internal titlebar cannot be seen anymore, and thus rendering it likewise immovable.

Check the codes below, adjust lnMove value based on how you set up your Chrome on your end.  Since in mine I show my bookmarks, then my adjustment is 100.  Maybe on the link I gave above on the command switches, there are commands to hide those, but I did not check anymore. :)

======

Sparked by last week's thread inside Foxite Forum about placing an IE Browser inside VFP Form, I thought to myself it would be cool to put Google Chrome inside our form for a change.

Also, this will ensure that most probably a webpage can be displayed properly being Chrome is always up to date with changes introduced now and then, as compared to IE that has been left far behind and is giving developers now some headache to fix it via Registry tweaks.


Googling does not give me any result on how this new sudden thought of mine can be done as I never found any that shows how to achieve this without downloading and working on extension designed to provide automation to google.  But I simply wanted chrome to be inside our VFP form using stock VFP commands and function plus utilizing WinAPIs.

Thursday, February 5, 2015

xBox with Dropdown Grid

Updates 2/10/2015

Added optional sort of tooltip guide containing the internal caption via _withGuide property (default is .T. or shown).  I realized that with the class relying on internal caption, it is sometimes hard to know where you are once the focus is on it (I feel sorry for my users) until they become so familiarize with the module.

I was adjusting our Request module when that realization hit me.  So if you want it shown, set it to .T..  However, please be aware that once you allow the guide to be shown, then the dropdown grid will adjust downwards to give room for it, otherwise it won't be seen.



Updates 2/9/2015

Thursday, January 29, 2015

TitleBarX Class

* Updates February 2, 2015

Added NoMax property to hide Max Button.  This should not be confused with _noMax property which simply disables the max button

Added NoMin property to hide Minimum Button

Added 3 shapes at the bottom to give an illusion of a gradient bottom border.  Although GDI+X is good for gradient, I want my classes to not be dependent of an external file like an .app.  Maybe in the future I may change decision or not

Added Form Pinning capability on Controlbox section.  When it is pinned, the pin icon will turn into red and you won't be able to move the form.  To unpin, click on it again

Removed the date and showed instead plain time().  Made it bigger

Added _shade method.  That is what you can use to get a different shade of the current color you  pick for other objects in the form (using _SwapColor Method).  So now you can implement color themes with variying shades not only on the class itself but on any objects you wish.  Here is how it looks like


Friday, January 16, 2015

Tick/Untick a checkbox on Grid with AllowCellSelection = .F.

Normally, when we want to put a checkbox on grid for the purpose of ticking and unticking it, then most probably most of you do it this way:



  • Set AllowCellSelection = .T.
  • Drill to every textbox object inside each columns and put under When method Return(.f.).  That is to prohibit the cell in getting focus


An alternative way is to set AllowCellSelection = .F. and use grid's double-click on toggling the value of the logical field bound to that checkbox, then perform a grid refresh

Monday, January 12, 2015

ShellExecute, Force open file to non-default application

As most of us know, ShellExecute() is a very useful tool to open a file on its external associated application.  When you issue this command:

Local lcFile
lcFile = Getfile('doc,docx')
If !Empty(m.lcFile)
      ShellExecute(0,'open',m.lcFile,'','',1)
Endif

Then that document file will be opened by MsWord or its counterpart like say on LibreOffice

Or if you do:

Local lcFile
lcFile = Getfile('xls,xlsx')
If !Empty(m.lcFile)
      ShellExecute(0,'open',m.lcFile,'','',1)
Endif

Or even:

Tuesday, December 30, 2014

Enumerate and Kill Selected Windows Processess


A question inside Foxite was raised yesterday requesting for a way to kill selected Windows processeses using API calls as what we normally use is the scripting way.  And googling around, there are ways shown by several developers; but none, AFAIK, that terminates successfully a process on each run/attempt.  

My first attempt yesterday combining information I gleamed across the web from several developers were not able to close the target process on every run.  Digging further, one fault I see is my usage of GetModuleFileNameEx is failing to get a proper result thus skipping onto the next process among processes list.  

Friday, December 19, 2014

xBox (a Textbox Control class)

Release 4

  • Made the appearance cleaner by imitating a plain textbox so when you resize on form during design time, you will see the borders cleanly
  • Fixed seeding initial Value via PEM
  • Added seeding via ExtraValue property which displays the correct Value counterpart  
  • Used inherent Picture property for alternate icon.  Removed icon property as that is just a waste of extra unneeded property. Although on form, when a picture for icon is selected, the icon image is shown tiled on the class
  • Added ControlSource, PasswordChar, ReadOnly, FontBold and FontItalic properties

Release 3

Color Toggling on Enabling/Disabling the class - Fixed

Seeding the class via .Value does not perform an AutoComp resulting to .ExtraValue giving a wrong result. Fixed that. However, seeding values to other xBoxes on the form with each having an AutoComp feature enabled short-circuits it; as each tries to perform an AutoComp search during when values are changed.

Solution is to ensure that only the active xBox will perform an AutoComp search. So now, you can do something like this: 

*xBox1's InterActiveChange
*  where search is made and seeding other xBoxes as we type
thisform.xBox2.Value = field2
thisform.xBox3.Value = field3
thisform.xBox4.Value = field6


And only xBox1 will perform the AutoComp search and the others will simply receive the values. Anyway, there is no need for the record pointer to change on those 3 others.

Caveat:

When seeding an xBox where you want it to perform an AutoComp search, then you have to ensure it is the active object in the form. Something like this:

Thisform.xBox1.SetFocus
Thisform.xBox1.Value = 'Whatever'

Say like when you open another form where you want to seed an xBox some value from the calling form and later would also like to reflect the .ExtraValue back, then you have to set focus onto it before the value is seeded.

If you are not after the .ExtraValue though and is only after the .Value, then no need to SetFocus on the class.