How to show a text box when I press a push button?
for example I have variable
set(handles.edNama2,'String',nama);
Value of nama is Elisabeth
My Push Button variable is DataPribadi
I want the text box to show with the personal data of Elisabeth
This creates text box:
handles.edNama2 = annotation('textbox', [your_position_of_the_text_box_here]);
set(handles.edNama2, 'String', ['He needs ', num2str(10), ' $USD!!!']);
This opens new message box for you:
msgbox(['I want ', num2str(1e+6), ' $USD']);
So you can put your info in the [], remember to convert to String type.
Related
I'm trying to create a macro that will select any slide that contains a keyword in the title, but not getting anywhere. The ppt includes different frontpages, disclaimers and content slides and the idea is to add keywords to the titles of each slide and get the macro to select and export the selected slides to PDF.
I've got the export part working, but have the enter the slide numbers manually.
I got the code below from a similar question, but can't rewrite it to select the slides instead of presenting the answers as a MsgBox. Can somebody help, please?
Sub FindText()
Dim sld As Slide, shp As Shape, list As String, myPhrase As String
myPhrase = InputBox("enter a phrase", "Search for what?")
For Each sld In Application.ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
If Left(shp.Name, 5) = "Title" Then
If Not shp.TextFrame.TextRange.Find(FindWhat:=myPhrase) Is Nothing Then
If list = "" Then list = sld.Name Else list = list & ", " & sld.Name
End If
End If
End If
Next shp
Next sld
MsgBox list
End Sub
My full code, using Steve's solution, if anyone is trying to solve the same problem:
Sub SelectedSlidesToPDF()
Dim sld As Slide, shp As Shape, list As String, myPhrase As String
myPhrase = "WhatYouLookFor"
For Each sld In Application.ActivePresentation.Slides
' FIRST, hide the slide:
sld.SlideShowTransition.Hidden = True
For Each shp In sld.Shapes
If shp.HasTextFrame Then
If Left(shp.Name, 5) = "Title" Then
If Not shp.TextFrame.TextRange.Find(FindWhat:=myPhrase) Is Nothing Then
' UNHIDE the slides that contain your keywords
sld.SlideShowTransition.Hidden = False
End If
End If
End If
Next shp
Next sld
'EXPORT slides
ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & "\" & "MySelectedSlides " & Format(DateSerial(Year(Date), Month(Date) - 1, 1), "yyyy-mm") & ".pdf", ppFixedFormatTypePDF, ppFixedFormatIntentPrint, RangeType:=ppShowAll
' UNIHDE all slides in presentation
For Each sld In ActivePresentation.Slides
sld.SlideShowTransition.Hidden = msoFalse
Next sld
End Sub
By default, when you save as PDF, the PDF won't include any slides that are hidden, so you can simply hide all the slides first, then UNHIDE any that you want to include in the PDF. While I haven't done this here, you'll want to UNHIDE all the slides again after saving to PDF.
For Each sld In Application.ActivePresentation.Slides
' FIRST, hide the slide:
sld.SlideShowTransition.Hidden = True
For Each shp In sld.Shapes
If shp.HasTextFrame Then
If Left(shp.Name, 5) = "Title" Then
If Not shp.TextFrame.TextRange.Find(FindWhat:=myPhrase) Is Nothing Then
' UNHIDE the slides that contain your keywords
sld.SlideShowTransition.Hidden = False
End If
End If
End If
Next shp
Next sld
Accept a customer number and then output the details of each order and items to an editor widget.
Display them in the editor widget ( editor-1 as object name).
define temp-table ttcustomer
field custnum like customer.cust-num
field cname like customer.name
field orders like order.order-num
field items like item.item-num
field itemname like item.item-name .
find first customer WHERE customer.cust-num = input f1 NO-LOCK .
create ttcustomer .
assign
ttcustomer.custnum = customer.cust-num
ttcustomer.cname = customer.name.
for each order WHERE Order.cust-num = input f1 NO-LOCK .
assign
ttcustomer.orders = order.order-num.
for each order-line where order-line.order-num = order.order-num no-lock.
for each item where item.item-num = order-line.item-num no-lock.
assign
ttcustomer.items = item.item-num
ttcustomer.itemname = item.item-name.
end.
end.
end.
I have no idea why you would want to display that on an editor. So I'll assume you want to concatenate the info you gathered in the for each loop into an editor.
So after the last end, you could do this:
define variable editor-1 as character view-as editor.
for each ttcustomer:
assign editor-1 = editor-1 + ttcustomer.items + ' ' + ttcustomer.itemname + chr(13).
end.
display editor-1.
If chr(13) doesn't work to skip a line, try chr(10).
PS: An editor is really probably not the widget you want to display this. I'd use a browse. But since the question asks for an editor, there.
PS2: You didn't assign the other fields you put on the temp-table, so I'm not displaying them. But it's just a matter of adding them to the assign line above, not forgetting the spaces, dashes or whatever you'd like to use as a separator.
I'm new to forms in MS access and I've created a form with a combo box that auto fills a few things i'm looking for, basically and name, phone #, and check out date. I have added another text box for "check in date" and I'm able to input the date but it will update the first record in the table that I'm pulling information from and not the record that the auto fill combo box displays. would anyone know a fix to update the record that the auto fill display versus the top record of the table?
Private Sub Combo0_Change()
Me.txtfname = Me.Combo0.Column(1)
Me.txtlname = Me.Combo0.Column(2)
Me.txtphone = Me.Combo0.Column(3)
Me.txtpump = Me.Combo0.Column(4)
Me.txtdateissue = Me.Combo0.Column(5)
Me.txtduedate = Me.Combo0.Column(6)
Me.txtCheckInDate = Me.Combo0.Column(7)
End Sub
Private Sub Combo0_Click()
End Sub
Private Sub txtCheckInDate_Change()
End Sub
get the source of Combo0 combobox, then in Private Sub txtCheckInDate_Change() function, change its source to that source + your filter, like
Me.Combo0.RowSource = "[Existing Combo Source SQL]" & _
" WHERE [YourDateField] = #" & me.txtCheckInDate & "#"
I need to input characters from a GUI but they need to be separated by spaces. Every time a new character is added, it should be appended to the existing array.
For example:
user enters 'a', the content of array is 'a'
if user enters 'b' next, the content of array is 'a b'
Edit 1
These lines of code should be inside the pushbutton1_callback function, so whenever the user presses the button, a new character should be added to static text; separated by a space.
Edit 2
My only line of code in here is:
letter = get(handles.edit1, 'string')
Without details I can provide a conceptual solution.
Initialize the variable that holds the text to:
txt = '';
Then the callback will do:
txt = strtrim(sprintf('%s %s',txt, get(handleToTextBox,'String')));
letter = get(handles.edit1, 'string');
global txt;
txt=[txt letter];
txt=[txt ' '];
set(handles.text1, 'string', txt);
That's how I solved it.
On a TabHost view I found there are 3 events. Click, LongClick and TabChanged. I found that only TabChanged works and I would like to use Click since the user may tap a tab and go back to the home screen and may want to tap the same tab again.
Here is the Sub Routine I used with TabChanged, but I would like to use Click instead. Maybe I need to change something in my code other than just changing the _TabChanged to _Click. If so, could you let me know what to change?
Sub tbhPagesEventHandler_TabChanged
ToastMessageShow(tbhPages.CurrentTab,False)
' These will make the code easier to read.
'-----------------------------------------
Dim intVisitsTab As Int : intVisitsTab = 0
Dim intMaintenanceTab As Int : intMaintenanceTab = 1
' Start the activity the user wants.
'-----------------------------------
Select tbhPages.CurrentTab
Case intVisitsTab
StartActivity("Visits")
Case intMaintenanceTab
StartActivity("Maintenance")
End Select
End Sub
I see you found a solution, based on your comment, but thought I'd post this for future readers in case it was useful.
The 'TabHost.Click' event fires when the content of the TabHost tab is clicked, not the tab itself.
If you use the following for your code, you can see the difference (this uses tbPages as the TabHost variable):
' Displays the 0-based index of the tab being activated
Sub tbPages_TabChanged
Msgbox("Current tab is " & tbPages.CurrentTab, "")
End Sub
' Fires when you click inside the content of the tab page,
' not on the tab itself.
Sub tbPages_Click
Msgbox("Current tab is " & tbPages.CurrentTab, "")
End Sub
This means you can use the CurrentTab property to determine which page the user has selected, and react accordingly:
Sub tbPages_TabChanged
Dim TabIdx as Int
TabIdx = tbPages.CurrentTab ' Get the tab just activated
Select TabIdx
Case 0
' First tab is now active
Case 1
' Second tab active
Case 2
' Third tab active
Case Else
MsgBox("Something is badly wrong! We have only three tabs", "HEY")
End Select
End Sub