Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MRKBAR does not recognize marked bar item. 1

Status
Not open for further replies.

iyarosh

Programmer
Apr 14, 2003
49
US
Hello,

I'm converting a program from FoxPro 2.6 to 6.0, which has a popup screen with menu that does not seem to function properly in Visual FoxPro. I mark the item with following statement: SET MARK OF BAR RECNO() OF pppName TO .T. When I scan trhough the menu to find marked records I use this line: IF MRKBAR('pppName',RECNO()), which ignores marked lines. It seems to be catching the lines that are selected with mouse, but not the marked ones. Checked the documentation and it looks like I'm doing it the right way.

Would anyone know how to get MRKBAR() to catch marked records or maybe how to select bars instead of marking them. You help is highly appreciated.

Thanks,
IY.
 
Hi iyarosh

Try this code:


Define popup PopTest from 10,30 margin shortcut
Define Bar 1 of PopTest Prompt 'Test Bar #1'
Define Bar 2 of PopTest Prompt 'Test Bar #2'
Define Bar 3 of PopTest Prompt 'Test Bar #3'
Define Bar 4 of PopTest Prompt 'Test Bar #4'

On Selection Popup PopTest MarkBar(bar())
Activate Popup PopTest
Clear all


Procedure MarkBar(tnBar)
Local i
For i = 1 TO cntbar('PopTest')
If mrkbar('PopTest', i)
Set mark of bar i of PopTest to .F.
endif
Next
Set mark of bar tnBar of PopTest to .T.
Activate popup PopTest bar tnBar
EndProc


Regards

-- AirCon --
 
Hello AirCon,

Thank you for your response; it was very helpful and saved me a lot of time, however, if you would, I still have some questions.
Your code is similar to what I have, but instead of mine it is working, that made me think that there is something wrong with definition of popup screen. Apparently MULTISELECT option causes MRKBAR() function not to work properly. I put MULTISELECT into your code and although it's working it behaves diffently; executes the code without mouse click right after I move the cursor over the popup. Would you know anything about it?

Thanks again.
Regards,
iyarosh.
 
iyarosh,

I think multiselect doesn't work with shortcut popup. It has to be a menu/system popup.

I can't give a real working menu, but try this:

Define popup PopTest from 10,30 margin multiselect
Define Bar 1 of PopTest Prompt 'Test Bar #1'
Define Bar 2 of PopTest Prompt 'Test Bar #2'
Define Bar 3 of PopTest Prompt 'Test Bar #3'
Define Bar 4 of PopTest Prompt 'Quit'

On Selection Popup PopTest MarkBar(bar())
Activate Popup PopTest
Clear all


Procedure MarkBar(tnBar)
Local i, lMark
If (tnBar != 4)
Set mark of bar tnBar of PopTest to .T.
else
Deactivate popup PopTest
endif
EndProc


Hope it helps
Regards

-- AirCon --
 
Hi AirCon,

It seems that MULTISELECT option does not work at all regardless of shortcut option, but your code alone simulates the functionality. Simple and effective. Thanks a bunch!!!
With a little modification it selects and deselects bar items, which exactly what MULTISELECT is suppose to be doing:
>>>
On Selection Popup tm_vnd MarkBar(bar())
>>>
Procedure MarkBar(tnBar)
If mrkbar('tm_vnd',tnBar)
Set mark of bar tnBar of tm_vnd to .F.
else
Set mark of bar tnBar of tm_vnd to .T.
endif
EndProc

Again, Thank you!
Regards,
iyarosh.
 
Glad it worked, and thank you for the star :)

Regards

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top