How to open an article from menu item in a popup window? - joomla

I need to open an article from a menu in a 800x600 popup window.
Any idea on how to achieve that?

You can use an extension called Modals, once it has been installed, go to you menu item and let's edit the title, for example if our menu item is called "About us", add this tags:
{modal}About Us{/modal}
Now let'd add the size for the window:
{modal width="800" height="600"}About Us{/modal}

Related

MFC: how to make menu item auto-adjust to fit long string?

When the caption of a menu item is long, part of it is cut off. Is there way to make it auto-adjust to fit the whole string?
POPUP "&File"
BEGIN
MENUITEM "This is a pretty long me&nu item...\tCtrl+N", ID_FILE_LONG_ONE
Below is the screen shot (with some text concealed). What is seen in design doesn't match runtime; it doesn't display "Ctrl+N".
As far as I'm concerned, the menu items are adaptive and can automatically adjust the width based on the length of the string.
Regarding the problem of not displaying shortcut keys, In my opinion, you may not add shortcut key resources to the control.
For example:
1,Add a menu item with the ID "ID_FILE_Long". When you only modify the "Caption" in the properties. The results are shown in the following figure:
2,I suggest you should try to add shortcut key resources to the menu item.Open the Accelerator resource in the Resource view. And then add a shortcut for the menu item with the ID "ID_FILE_Long", as shown in the figure below:
3,The results are shown in the following figure:

I do not want a modal window to appear

Im trying upload image. When I click on "Choose image", the modal window is displayed. But i do not want to show this window.
I have to click on "Choose image" because html attributes (to which I upload an image) are not visible for watir, after click on "Choose image" html attributes are visible.
Im using this for upload image to "Choose image" :
img_path = File.expand_path('../image/png.png', File.dirname(__FILE__))
after this i use this variable(img_path) and i set image to "Choose image".
Now i want take a screenshot but modal window is still here.
I used :
1) browser.modal_dialog.close
2) browser.send_keys(:escape)
3) browser.window(:title => Watir::FileField::WINDOW_TITLES).close
I tried use all "alerts" commands, which i found at watir.com GUIDES - ALERTS
I found this but it doesn't work as well: browser.windows.last.use
I tried to execute some scripts but without response: execute_script
So question is. How to block or how to do not show Windows or Browser window after click?.
Or do we have to change html so that this attribute is visible in html without clicking on "Select Image"? After that we can upload the image without clicking?
Modal window after a click
browser.iframe(class: "modalwin").present?
browser.iframe(class: "modalwin").element(xpath that click on choose image).click
img_path = File.expand_path('../image/png.png', File.dirname(__FILE__))
browser.iframe(class: 'modalwin').file_field(path to set file).set img_path
browser.iframe(class: "modalwin").element(waiting xpath).wait_while_present
browser.iframe(class: "modalwin").link(xpath that just click on button OK).click
This is my code that left the window open. Unfortunately.
This is my first question here so i hope everything will be ok. Thank you for your answers. I hope everything is written here. Otherwise, i will try to write better informations.
The problem is that what has popped up is neither a "Browser Window" nor an "Alert." It is not even controlled by the browser, but by the operating system. Since Watir can only control the browser, it can not dismiss it.
Watir allows you to upload a file without clicking on the element that opens that dialog box in the first place. So remove the line that clicks the image and just send the image path to the file field element. It should not enforce visibility in order to interact with it.
I found a solution. I hope it help to others.
You need to execute script like this:
browser.execute_script(
'HTMLInputElement.prototype.click = function() {'\
" if(this.type !== 'file') HTMLElement.prototype.click.call(this);"\
'}'
)
img_path = File.expand_path(opts[:image_path], File.dirname(__FILE__))
browser.iframe(class: modal_win).element(:xpath, choose_image).click
browser.iframe(id: modal_iframe1).file_field(:name, 'data').set img_path

Delphi FMX TMainMenu first menu item doesn't show in OSX, OK in WIndows

I created a Multi-Device Application in Delphi Seattle and added a TMainMenu with MenuItem1 and MenuItem2 (nothing else). Building and running for OSX, only MenuItem2 shows. Building and running for Windows, both menu items show. I didn't treat the two menu items any differently. Both were just added and not customized in any way. Anyone else experience this?
The top level items in a Mac menu bar typically look like this:
Apple/system menu ('About this Mac', 'System Preferences...', etc.)
Application menu ('About XXX', 'Services', 'Hide XXX', 'Hide Others',
'Show All', 'Quit XXX')
File menu
Edit Menu
...
In FMX (excepting the very first version), the first top level item in a TMainMenu represents the application menu. As such, you need to add an item before File (or whatever is your current first item) that is only show on OS X; its sub-items should then include the usual items of a Mac application menu. To implement those items' behaviour, you can utilise standard actions (TFileHideApp, TFileHideAppOthers, TFileExit). Or, in more detail:
If there isn't one already, add a TActionList component to the form
Double click the action list to bring up the action list editor
Click on the add button's dropdown arrow, and select New Standard Action...
Select all of TFileHideApp, TFileHideAppOthers and TFileExit, and click OK
Back on the form, open up the menu editor by double clicking on the TMainMenu component
Add an item immediately before the first one that currently exists; in the Object Inspector, call it (say) mnuApp
Add at least four child items to mnuApp; using the Object Inspector, assign the Action property of the first to FileHideApp1, the second to FileHideAppOthers, and the fourth to FileExit1; set the Text of the third to a hyphen (-) to make it a separator
Close the menu editor
If one doesn't already exist, create a OnCreate handler for the form by double clicking its entry in the Object Inspector
Add to FormCreate a line to hide mnuApp if not running on OS X. Conversely, if you already have a menu item for File|Exit, this should be hidden if running on OS X since the functionality is now Quit under the application menu:
...
procedure TForm1.FormCreate(Sender: TObject);
begin
mnuApp.Visible := (TOSVersion.Platform = pfMacOS);
itmExit.Visible := (TOSVersion.Platform <> pfMacOS);
end;

How can I make a CMenu TrackPopupMenu SubMenu menu-item clickable?

Normally when you hover over a sub-menu (with the little arrow) on a CMenu menu item it delays briefly then shows the sub-menu items. Also, if you click the item before the delay timeout, it shows the sub menu items. I want the delay behavior, but I want a different behavior for the click. That is, I want the sub-menu itself (the one with the arrow) to be a clickable entity too, i.e. it has an ID and results in a WM_COMMAND and menu dismissal.
The idea is, the main sub-menu menu item is a "default", and the sub-menu items are modified versions, e.g. "print->" (defaulting to default printer), and sub-menu items like "print preview" "print to file" etc. Thanks for thoughts/suggestions.
edit:
IDR_MY_MENU MENUEX
BEGIN
POPUP "menu"
BEGIN
MENUITEM "&Something Else", ID_MENU_SOMETHING_ELSE
POPUP "&Print", ID_MENU_PRINT
BEGIN
MENUITEM "Print Pre&view", ID_MENU_PRINT_PREVIEW
MENUITEM "Print to &File", ID_MENU_PRINT_TO_FILE
END
MENUITEM "", -1, MFT_SEPARATOR
MENUITEM "&Bottom", ID_MENU_BOTTOM
MENUITEM "&Done", ID_MENU_DONE
END
END
I dont know if theres a better way as I last did this 2 years ago, but the way I solved the problem had one constraint: that you own the whole menu. If you do own the whole menu what you can do is create two columns (two columns in the menu/submenu that is, not a new submenu) and use the right column as a submenu and the left column as the default.
For future StackOverflowers, here's what I did...
Added a handler for OnInitMenuPopup and corresponding
ON_WM_INITMENUPOPUP(), although doing this messed up my UPDATE_COMMAND_UI handler but I was able to resolve that by moving that code into the OnInitMenuPopup handler.
In the OnInitMenuPopup handler, set a hook for the mouse SetWindowsHookEx(WH_MOUSE,...) (checking if one isn't already set because sub-menus can cause multiple calls)... and for each menu that initializes during the hook, push the HMENU onto a linked list.
In the mouse hook proc, checking the end of the list and working toward the front, verify each HMENU is still and active menu via IsMenu and remove it if it isn't. If there are no menus left, UnhookWindowsHook.
If there are menus left in the hook proc, check for WM_LBUTTONUP or WM_RBUTTONUP and see if happened over one of your menu items (because of coordinate mapping of screen versus sub-menu that I couldn't figure out I ended up simply cycling through the menu items via GetMenuItemRect and checking PtInRect to determine this).
If there is a click hit, do GetMenuItemInfo on the item, and if there's a hSubMenu for that item and it has an wID (and the wID doesn't match the sub-menu handle), simply post the id as a WM_COMMAND, post a WM_CANCELMODE to dismiss the menu, and disable the hook... Bingo!
So, seems to work fine and everything else functions like normal. The only issue at this point is a keyboard handler for selecting the item instead opening the sub-menu but I suspect the same idea works there as well.
Also, I added the main sub-menu text as the first item in the sub-menu list with a separator which added some clarity to what the menu was doing.

VB6 + how to switch between windows/frame in form by buttons

I am very new beginner with VB6 and I hope I explain the things right
I want to create form with 2 buttons (the buttons are located on the top form position )
So each button will switch to other form/window/frame
For example
The first button will show window 1 (there I can set only parameters)
The second button will show window 2 (there I can set only IP address)
Please advice if we can do that by VB6 ?
And if yes how to do that ( step by step )
Remark - Similar example but with multiple windows in the same form is the system properties ( right click on my computer and properties ) , the we can see each button will view different window
Create a form with 2 buttons, Command1 and Command2.
On this form, create 2 frames, Frame1 and Frame2. hide Frame2 and make sure to line up both framesso that they are of the same size and located right on top of each other (Top, Left, Width and Height properties must be the same)
Now put this code in:
Private Sub Command1_Click()
Frame1.Visible = True
Frame2.Visible = False
End Sub
Private Sub Command2_Click()
Frame1.Visible = False
Frame2.Visible = True
End Sub
Now each the first button shows the first frame while hiding the 2nd. The second button hides the first frame and shows the seconds. I think this is the simplest way to implement your task.
PS: don't forget to name your objects properly, it's not a good idea to have default names like Command1 or Frame2 - should be more descriptive than that.
It sounds like you are asking about the tabbed dialog control. To use a tabbed dialog control in VB6:
Click Project -> Components
Scroll down to "Microsoft Tabbed Dialog Control 6.0" and select it.
Click the Apply button.
You should notice a new control in the component tool box. If you do not see the toolbox, click View -> ToolBox. This is the same area of the IDE where you first click to add a button to a form. The tabbed dialog control looks like the top tab of several file folders. When you hover your mouse over the control in the toolbox, you will see a tool tip text of "SSTab". Click this control and then draw a rectangle on your form.
By default, this will add a tabbed dialog control with 3 tabs, but you can change this in the properties window. You can now create any control on top of a tab of the tabbed dialog control and interact with the control exactly the same way you would if the control was placed on the form itself.
What you want is called an MDI Form. It's a form that contains other forms.
You can find a full tutorial on them here, but here's the gist of what you want to do:
Set the "MDIChild" property of all your subforms you want to use to True. Disable their minimize, maximize, and resize functions as well.
Create an MDIForm. Disable its AutoShowChildren property.
Add a toolbar to the MDIForm. Add buttons to the toolbar corresponding to the forms you'll be switching between.
Implement each button's click event, to create child form as expected (or switch to an existing one).

Resources