How can I change the order of ToolButtons in a inheritable form? - forms

I have two forms. The first one has a TToolBar and two TToolButton. The second one inherits the first one and has three more TToolButton.
I change the order of the buttons in design time, putting the three buttons of the second form before the buttons of the first form. When the application is running, the buttons of the second form appear after the buttons of the first form.
Is there a way to use the order set in design time?

No, there is no way to override the position of buttons inherited from the ancestor form. Buttons on a TToolBar are contained in a simple TList and are added in the order that they are created. They are created in the order that they appear in the .dfm file and, when inheriting a form, the ancestor's controls are always created and added first.
Even if you reorder the buttons at design time, save the form, and then close and re-open it the layout will only preserve the ordering changes to the descendent form's toolbar buttons with the ancestor buttons reappearing at the beginning again.
This is a limitation of the TToolBar class itself. Your options are to either write a custom toolbar or to manage the button arrangement programmatically.

Related

Can I add 2 different button classes' in a trigger under the main tag and get proper data in my GA?

In a pricing page, there is a "Buy" button when user clicks on the button, it takes to a page where the user chooses payment type and again there is a button with another class, I want to track both of them. Is it possible to set up 2 button classes(in one trigger) under the button click tag and get proper data in GA?
You can achieve this, but not in this way, as visible on your screenshot. These conditions have AND relation. So your current trigger requires a click on an element with a class containing payment-button price-btn AND btn-pay at the same time.
So you need to create two separate triggers for the two class variants, and attach both of them to the same tag as firing triggers, as those will have OR condition among themselves.
Please note, that payment-button price-btn will look for this string. So if there's any chance, that the classes don't appear in this exact order, you might want to go for just one of them, or separate these two classes in two rows of one trigger, payment-button and price-btn.

MS Access Form Development: Hide Objects when an Option Button is Pressed without coding for each Object that needs to be hidden

MS Access Development Question:
I have 3 options and I need each one associated with a different set of objects. Therefore, if you click option 1, a set of objects will appear in a box I'm referring to as "Report Parameters". If I click option 2, the objects in the "Report Parameters" box will disappear and a new set of objects will appear.
I didn't want to write code to switch each object from visible = true to visible = false. I thought that would take too long, especially if the number of option buttons or the objects related to it grow.
So I'm trying several things...
I tried putting all objects, that relate to a particular option, in a Subform. Therefore, I would have three subforms and that would sit in the same position on my main form. When you click on an option, the subform for that option is made visible any anything else is hidden. But I have a background picture that needs to be visible on the main form and you can't make the subform background transparent.
I used Tab Controls; however, I didn't want to use the tabs to control the switch between objects. I can hide the tabs but you can still switch between them if you click the space where the tab should be. It can be made transparent though so that helps a lot.
I need something in-between a Subform and Tab Control but I've hit a dead end. Does anyone have any other suggestions or recommendations? Or am I stuck coding for each object?
I'm an experienced VBA developer. My last option was to run a query against the form and pull all object names and save it to a table. Since the syntax of the name for each object connects it to a button, I can always run a loop that makes all objects visible/invisible if the object's name corresponds with a specific option... but... I guess I'm trying to find a shortcut. Let me know what you think! Thanks.
I was able to resolve my issue. I just needed to do some thinking... so writing up this question was a bit premature. I'll write down what I did in the event that someone has the same issue I have.
First, I used the Tab Control object to resolve my issue. I made the control transparent and named each page to reflect the Option Button I was selecting.
I then mapped each option to a button in the VBA code of the button. Therefore, when the button is selected it does several things.
First, it makes the default value of any of the other options equal to false. I also set the visibility of their corresponding pages to false.
Second, I select the page I need visible and set the visibility to true. I also make it my active page.
Lastly, as a safety measure, if the option button is already selected, and you select it again, by setting the value of that option to true. This is to prevent it from changing to false. One option should always be selected.
Hope that all made sense!

Access Menu sub form - No default Tab stop

I have a main form...imagine that...that for most of my users will be the only form they use. Naturally, it contains tabs with sub forms.
I have a navigation sub form on the left side of this form that changes based on the user's rights level. Currently, this sub form is all buttons...and 1 always is selected as the default tab stop for that form.
I don't want to highlight any of them at first...and I can remove the highlight by switching off Tab Stops for all buttons. However, I'm not sure that I want to remove that functionality all together...and it still highlights a button. I'd just like for there to not be a default button highlighted.
As you can see, Add Course is 'selected'. I can't seem to find the correct terminology to search for a way to do this. I tried using a smaller button set behind another button, but since it has the focus, it moves to the front. Using a text field with the same colors as the background shows the cursor in a random, blank area...not visually ideal.
I'm sure that there is someone here clever enough to have this figured out. Please enlighten me. I don't care if this can be handled in VBA code or through design view.
"Focus" is the word you're looking for - you don't want any visible control to have the focus when opening the form.
The easiest method is an invisible button: create a button with Transparent = True, and an empty OnClick (i.e. the button does nothing, even when accidentally clicked).
Move this button to the top in the Tab Order, so it has the focus when opening the form.
But if your users use TAB to walk through the buttons, there will be one position where the focus disappears (when circling around from the last to first control). I don't know if it will confuse them.
Create a button on the main form itself.
Named is cmdDummyButton with the following GotFocus event code.
Set the tab order property to 0 (ie first)
Make the button transparent.
This will cause no control on the form to have the focus when it starts up.
Private Sub cmdDummyButton_GotFocus()
Static IveHadFocusAlready As Boolean
If Not IveHadFocusAlready Then
Me.cmdDummyButton.Enabled = False
IveHadFocusAlready = True
End If
End Sub
Sweet.

SmartGWT: hide current element showing in Canvas

I'm working something like a dynamic menu, where you click some radio buttons and it shows a specific form, each radio control matches to a different form.
Examples from the showcase always base themselves on the Tabs widget and I don't need that behaviour.
I opted for placing all the forms inside one Canvas and hide/show them accordingly (Not sure this was the best idea, if someone knows better I would like to hear it)
Now my problem is that every onClick event has to .show() one form and .hide() the other 9. that is annoying.
Is there a way to "get" the current displayed child in the Canvas and hide it?
If what you want is basically mutex display, you could put all the components as members of a Layout instead of a Canvas, then use setVisibleMember(). That hides all other members.

UITableView form

I am having very annoying issue. I have one form page with 5 custom cells. Each of them has one text field. On the bottom I have one button. In an onclick button function I am gathering values from each of the 5 described text fields.
My problem is that if my keyboard is up, I will get the values of not all but just visible text fields, the ones I don't see are null.
How to override this?
Thx,
Mladen
Separate data you have from your interface, that is store your textfield values in some other place right after you finish input. And access your data there.
UI elements are not intended to store data, but just to display it and allow input - as you can see in your case if you do not see a particular element you cannot be sure that it actually exists.
This might solve your problem..
1. Register your viewcontroller for KeboardNotifications
2.When keyboard will appear resize the view so that all fields will be visible.
3. When keboard will disappear just resize it back and continue..